Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

Students also viewed these Databases questions

Question

x-3+1, x23 Let f(x) = -*+3, * Answered: 1 week ago

Answered: 1 week ago