Question: 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

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 from (src off+ 1)th byte to the end of the source file to destination file at (dst off+ 1)th 2. The program should accept following commands S.ame HW1 source file destination file S.ame HW1 source file src off destination file S.ame HW1 source file destination file dst off If the offset option is omitted, by default, offset becomes 0. Other than three commands specified above, the error message should be returned if you try a command such as $.ame HW1 src.off source file dst off destination file S.ame HW1 source file destination file 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 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 destination 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. Compile using 'make name_HW1 (without .)' in the 'fileio' directory given in the source file distribution of the textbook
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
