Question: 1. * (40 points) In the following program, a child will writes a string to a pipe and th e parent reads the string from

 1. * (40 points) In the following program, a child willwrites a string to a pipe and th e parent reads the

1. * (40 points) In the following program, a child will writes a string to a pipe and th e parent reads the string from the pipe. (a) Read the man page of pipe system call. b) Fil 1 in the blanks in the code provided and make sure it works as the description above. (c) Compile the code and make sure it is executable. (d) Upload the source code. #include #include #include #include #1efine BUFSIZE 10 int main (void) char bu fin[BUFSIZE] ="empty". char bufout [] ="hello"; int bytesin; pid.t childpid; int fd [2]; )create a pipe *,/ perror (" Failed to create the pipe"); return 1; bytesin = strlen (bufin); childpid fork(); perror (" Failed to fork"); return 1; /* child code */ else *parent code */ fprintf(stderr, %ld]:my bufin return 0; write(-, bufout, strlen (bufout)+1); read(-_-_ bufin, BUFSIZE); is bytesin = {%.*s, my bufout is {%s} ", (long) getpid(), bytesin, bufin , bufout); Asg-pipe.o.c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!