Question: PLEASE WRITE C CODE ACCORDING TO BELOW CRITERIA AND SHOW THAT IT WORKS!!!! Write a C code that copies one file from the source file

PLEASE WRITE C CODE ACCORDING TO BELOW CRITERIA AND SHOW THAT IT WORKS!!!!

PLEASE WRITE C CODE ACCORDING TO BELOW CRITERIA AND SHOW THAT IT

Write a C code that copies one file from the source file to destination file with two offset values as follows: $.ame HW1 source file src off destination file dst off 1, name-HW1 program copies the contents of source file (sourcefile) from (src-of- (dst off+ 1)t The program should accept following commands 1)th byte to the end of the source file to the destination file (destination file) at 2. $.ame HW1 source file destination file $.ame HW1 source file src off destinationfile $.ame HW1 source file destination file dst off If the offset option is omitted, by default, the omitted offset becomes 0. Other than three commands specified above, an error message should be returned ifyou try a command such as $.ame HW1 src off sourcefile dst off destination file $.ame HW1 source file destinationfile src off dst off 3. Validation check should be performed for offset values (negative and float offsets are not accepted). 4. If the destination file exists, existing content of that file should be preserved. The contents of the destination file will be kept before and including the dst off. 5. When the specified starting point to copy is greater than the file size of the source file, nothing will be copied (the size of the destination_file will be zero if the destination file does not exit. Tips: Use 'getlnt(.. )' or 'getLong(... )' functions to convert the numeric input string to integer defined in tlpi hdr.h header file. You can refer two sample codes (fileio/copy.c and fileio/seek io.c) covered in the lecture. Work in the 'fileio' directory given in the source file distribution of the textbook and Compile using 'make name HW1 (without.c) Write a C code that copies one file from the source file to destination file with two offset values as follows: $.ame HW1 source file src off destination file dst off 1, name-HW1 program copies the contents of source file (sourcefile) from (src-of- (dst off+ 1)t The program should accept following commands 1)th byte to the end of the source file to the destination file (destination file) at 2. $.ame HW1 source file destination file $.ame HW1 source file src off destinationfile $.ame HW1 source file destination file dst off If the offset option is omitted, by default, the omitted offset becomes 0. Other than three commands specified above, an error message should be returned ifyou try a command such as $.ame HW1 src off sourcefile dst off destination file $.ame HW1 source file destinationfile src off dst off 3. Validation check should be performed for offset values (negative and float offsets are not accepted). 4. If the destination file exists, existing content of that file should be preserved. The contents of the destination file will be kept before and including the dst off. 5. When the specified starting point to copy is greater than the file size of the source file, nothing will be copied (the size of the destination_file will be zero if the destination file does not exit. Tips: Use 'getlnt(.. )' or 'getLong(... )' functions to convert the numeric input string to integer defined in tlpi hdr.h header file. You can refer two sample codes (fileio/copy.c and fileio/seek io.c) covered in the lecture. Work in the 'fileio' directory given in the source file distribution of the textbook and Compile using 'make name HW1 (without.c)

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!