Question: Write a C code that copies one file from the original file to destination file as follows. $./copy_HW1 off 1 original_file off 2 destination_file This
Write a C code that copies one file from the original file to destination file as follows. $./copy_HW1 off 1 original_file off 2 destination_file This usage of command, copy_HW1 shows that copy_HW1 program copies from (off1 + 1)^th byte to the end of the original_file to destination_file starting from (off2 + 1)^th byte. example: $./copy_HW1 100 x.txt 50 y.txt: copies contents from 101^st bytes to the end of x.txt file to 51^st byte position of y.txt The number of command arguments should accept 3 or 4 or 5 arguments. $./copy_HW1 original_file destination _file copies original_file to destination_file starting from the first position for both files $./copy_HW1 off1 original_file destination file copies original_file starting from (off1 + 1)^th byte to destination_file starting from the first position $./copy_HW1 original_file off2 destination_file copies original_file starting from the first byte to destination_file starting from the (off2 + 1)^th byte Other than this, error message should be returned. Invalid offset value (for example-1 for SEEK_SET) should be checked giving an error message such as "Invalid argument". When the specified starting point is greater than the file size of the original_file destination_file will have empty content (size 0) Use 'getLong(...)' function defined in tlpi_hdr.h header file Compile using'middotmake copy_HW1' in the 'fileio' directory given in the source file distribution of the textbook. Each case (1 through 5 with different arguments) will be tested
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
