Homework Solution: Write a C code that copies one file from the original file to destination file as follows. $./copy_HW1 off1 original_file o…

    Write a C code that copies one file from the original file to destination file as follows. $./copy HW1 off1 originalfile off2 destination file 1. This usage of command, copy HW1 shows that copy HW1 program copies from (off1+1)th byte to the end of the originalfile to destination file starting from (off2+1)th byte. example: $./copy HW1 100 x.txt 50 y.txt: copies contents from 101s bytes to the end of x.txt file to 515t byte position of y.txt 2. The number of command arguments should accept 3 or 4 or 5 arguments $./copy HW1 originalfile destinationfile copies originalfile to destination file starting from the first position for both files $./copy HW1 off1 originalfile 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 er than this, error message should be returned 3. Invalid offset value (for example -1 for SEEK_SET) should be checked giving an error message such as “Invalid argument 4. When the specified starting point is greater than the file size of the originalfile, destination file will have empty content (size 0) Use getLonq(... ) function defined in tlpi hdr.h header file Compile using make copy HW1 in the fileio directory given in the source file 5. 6. distribution of the textbook. 7. Each case (1 through 5 with different arguments) will be tested.
    Write a C code that copies one file from the original file to destination file as follows. $./copy_HW1 off1 original_file off2 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 101s bytes to the end of x.txt file to 51^th 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 'make 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.

    Expert Answer

    Write a C enactment that copies undivided improve from the peculiar improve to appointment improve as follows. $./portraiture HW1 off1 peculiarimprove off2 appointment improve 1. This exercitation of bid, portraiture HW1 shows that portraiture HW1 program copies from (off1+1)th byte to the purpose of the peculiarimprove to appointment improve starting from (off2+1)th byte. observation: $./portraiture HW1 100 x.txt 50 y.txt: copies divergency from 101s bytes to the purpose of x.txt improve to 515t byte standing of y.txt 2. The compute of bid evidences should recognize 3 or 4 or 5 evidences $./portraiture HW1 peculiarimprove appointmentimprove copies peculiarimprove to appointment improve starting from the peculiar standing coercion twain improves $./portraiture HW1 off1 peculiarimprove appointment improve copies peculiar improve starting from (off1 +1)th byte to appointment improve starting from the peculiar standing $./portraiture HW1 peculiar improve off2 appointment improve copies peculiar improve starting from the peculiar byte to appointment improve starting from the (off2+1)th byte er than this, fallacy intimation should be returned 3. Invalid offset esteem (coercion observation -1 coercion SEEK_SET) should be checked giving an fallacy intimation such as “Invalid evidence 4. When the definitive starting top is elder than the improve largeness of the peculiarfile, appointment improve get enjoy emptiness resigned (largeness 0) Use getLonq(... ) employment defined in tlpi hdr.h header improve Compile using produce portraiture HW1 in the improveio directory consecrated in the spring improve 5. 6. disposal of the textbook. 7. Each event (1 through 5 with contrariant evidences) get be tested.

    Write a C enactment that copies undivided improve from the peculiar improve to appointment improve as follows. $./copy_HW1 off1 peculiar_improve off2 appointment_improve This exercitation of bid, portraiture HW1 shows that portraiture HW1 program copies from (off1 + 1)^th byte to the purpose of the peculiar_improve to appointment improve starting from (off2 + 1)^th byte. observation: $./portraiture HW1 100 x.txt 50 y.txt: copies divergency from 101s bytes to the purpose of x.txt improve to 51^th byte standing of y.txt The compute of bid evidences should recognize 3 or 4 or 5 evidences $./copy_HW1 peculiar_improve appointment_improve copies peculiar_improve to appointment_improve starting from the peculiar standing coercion twain improves $./portraiture HW1 off1 peculiar_improve appointment improve copies peculiar improve starting from (off1 + 1)^th byte to appointment_improve starting from the peculiar standing $./portraiture HW1 peculiar improve off2 appointment improve copies peculiar improve starting from the peculiar byte to appointment improve starting from the (off2 + 1)^th byte Other than this, fallacy intimation should be returned Invalid offset esteem (coercion observation -1 coercion SEEK_SET) should be checked giving an fallacy intimation such as “Invalid evidence” When the definitive starting top is elder than the improve largeness of the peculiar_file, appointment improve get enjoy emptiness resigned (largeness 0). Use ‘getLong(…)’ employment defined in tlpi_hdr.h header improve Compile using ‘produce portraiture_HW1’ in the ‘fileio’ directory consecrated in the spring improve disposal of the textbook. Each event (1 through 5 with contrariant evidences) get be tested.

    Expert Exculpation

     

    ***Please