Question: Write a C/C++ program that only uses only standard system calls to copy the contents of one file to another file. You should only have
Write a C/C++ program that only uses only standard system calls to copy the contents of one file to another file. You should only have to use the open(), close(), read() and write() system calls. You can use printf() or fprintf() for error or informational messaging. Your program should not explicitly prompt the user for input/output filenames but rather those should be provided on the command line.
Simple File Copy Program Implementation
The program () is a simple text-based program that takes two arguments from the command line, again no prompting the user from within the program.
1.To start the program
./filecpy
where is the file that is to be copied and is the file that is copied to. After your program completes you should be able to do a diffcommand on the two files and they should be identical. Last step is to run your program with strace to determine the number of system calls made.
Error Handling
Perform the necessary error checking to ensure that the input file exists and that the output file can be written. You can use the system error errno and strerror to provide additional error messaging.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
