Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The idea of this exercise is to communicate between a child and a parent using a shared file that the user will specify. Your program

The idea of this exercise is to communicate between a child and a parent using a shared file that the user will specify. Your program will require the name of the file to be sent as a command line argument (argv[1]) A skeleton algorithm is provided below: Check that the number of command line arguments is 2. If it isn't, produce an error message. Note: you cannot use perror here. Use "fork" to produce a child and parent Child will: open the file for writing (make sure to use the "create" flag and permissions for the user to read and write) check for errors on opening and use perror to describe the error. read from standard input (until end of file,ie., you type CTRL-D) write to the file when done, close the file Parent will: "wait" for the child open the file for reading check for errors on opening and use perror to describe the error. write a message that you are in the parent read from the file (until end of file) write to standard output when done, close the file Don't forget to handle the error situation.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

risk of human going to mars

Answered: 1 week ago