Question: C PROGRAMMING 2. Return value from child process to parent process (ChildCP.c): Write a C program that reads 2 file names and creates a child

C PROGRAMMING

C PROGRAMMING 2. Return value from child process to parent process (ChildCP.c):

2. Return value from child process to parent process (ChildCP.c): Write a C program that reads 2 file names and creates a child process that performs a copy operation from the source file into the destination file. Before the parent process terminates, it should wait for the child process to finish. If the child process encounters an error, it prints a proper message and returns a special error code (some agreed upon number) to the parent process. After the child process terminates, the parent process should retrieve the return value from the child process and prints a proper message then terminates. The parent process prints either: o "File copied successfully by child process..."; child process succeeded in copying the file. o "Bailing out ...."; child process failed in copying the file. Temp$ Temp$ ./ChildCP sample1 sample2.txt Error opening file: sample1 Bailing out .... Temp$ ./ChildCP sample1.txt sample2.txt File copied successfuly by child process Temp$

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!