Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C program called duplicate which simply copies a file from one place to another. The program will be invoked as follows duplicate SourceFile
Write a C program called duplicate which simply copies a file from one place to another. The program will be invoked as follows duplicate SourceFile TargetFile duplicate must create an exact duplicate of SourceFile under the new name TargetFile Upon successful completion, duplicate should report the total number of bytes copied and exit with result zero. For example duplicate: Copied 38475 bytes from file foobar to bizbaz. where "SourceFile" is foobar and "TargetFile" is bizbaz If the duplicate takes longer than one second, then every second the program will emit a short message duplicate: still duplicateing... duplicate: still duplicateing... duplicate: still duplicateing... If duplicate encounters any kind of error or user mistake, it must immediately stop and emit a message that states the program name, the failing operation, and the reason for the failure, and then exit with result 1. For example duplicate: Couldn't open file foobar: Permission Denied duplicate: Couldn't write to file bizbaz: Disk Full If the program is invoked incorrectly, then it should immediately exit with a helpful message duplicate: Too many argumentsl usage: duplicate Write also a test C program showing the use "duplicate" program. Provide source codes and screenshot of the tests
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started