Question: Part 2: Concatenating to files into a third one (12 points): You are asked to write a program that generates an output file, the context

Part 2: Concatenating to files into a third one (12 points): You are asked to write a program that generates an output file, the context of which is derived by concatenating the contexts of two input files. Your program will be labeled myfiles and will take two or three arguments. The first and second arguments must be the input files, while the third argument must be the output file. The default name for the output file is myfile.out Note 1 (6 pts): If your program is run without the proper arguments, you must make sure that the proper message appears on screen that guides the user into how many and what sort of arguments are required. If one of the input files provided in the arguments does not exist, then the program must print on screen the corresponding error message. Note 2 (3 pts): Execute your program using OS instruction strace (research on how this works). Copy the output of strace that is produced from your code. Note 3 (3 pts): Modify your initial code to support indefinite number of input files. The last argument though is always the output file. For your implementation you are expected to use the following functions: void WriteInFile (int fd, const char *buff, int len): writes data to file descriptor fd. void CopyFile (int fd, const char *file-in): writes the contexts from file named file-in to file descriptor fd. WritelnFile is called from within CopyFile
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
