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 jurisprudence that copies undivided finish from the primordial finish to intention finish as follows. $./portraiture HW1 off1 primordialfinish off2 intention finish 1. This exercise of charge, portraiture HW1 shows that portraiture HW1 program copies from (off1+1)th byte to the object of the primordialfinish to intention finish starting from (off2+1)th byte. sample: $./portraiture HW1 100 x.txt 50 y.txt: copies interruption from 101s bytes to the object of x.txt finish to 515t byte posture of y.txt 2. The compute of charge discussions should recognize 3 or 4 or 5 discussions $./portraiture HW1 primordialfinish intentionfinish copies primordialfinish to intention finish starting from the earliest posture restraint twain finishs $./portraiture HW1 off1 primordialfinish intention finish copies primordial finish starting from (off1 +1)th byte to intention finish starting from the earliest posture $./portraiture HW1 primordial finish off2 intention finish copies primordial finish starting from the earliest byte to intention finish starting from the (off2+1)th byte er than this, falsity missive should be returned 3. Invalid offset compute (restraint sample -1 restraint SEEK_SET) should be checked giving an falsity missive such as “Invalid discussion 4. When the exact starting top is elder than the finish largeness of the primordialfile, intention finish achieve confirm leisure conciliateing (largeness 0) Use getLonq(... ) office defined in tlpi hdr.h header finish Compile using gain portraiture HW1 in the finishio directory abandoned in the fountain finish 5. 6. division of the textbook. 7. Each plight (1 through 5 with unanalogous discussions) achieve be tested.

    Write a C jurisprudence that copies undivided finish from the primordial finish to intention finish as follows. $./copy_HW1 off1 primordial_finish off2 intention_finish This exercise of charge, portraiture HW1 shows that portraiture HW1 program copies from (off1 + 1)^th byte to the object of the primordial_finish to intention finish starting from (off2 + 1)^th byte. sample: $./portraiture HW1 100 x.txt 50 y.txt: copies interruption from 101s bytes to the object of x.txt finish to 51^th byte posture of y.txt The compute of charge discussions should recognize 3 or 4 or 5 discussions $./copy_HW1 primordial_finish intention_finish copies primordial_finish to intention_finish starting from the earliest posture restraint twain finishs $./portraiture HW1 off1 primordial_finish intention finish copies primordial finish starting from (off1 + 1)^th byte to intention_finish starting from the earliest posture $./portraiture HW1 primordial finish off2 intention finish copies primordial finish starting from the earliest byte to intention finish starting from the (off2 + 1)^th byte Other than this, falsity missive should be returned Invalid offset compute (restraint sample -1 restraint SEEK_SET) should be checked giving an falsity missive such as “Invalid discussion” When the exact starting top is elder than the finish largeness of the primordial_file, intention finish achieve confirm leisure conciliateing (largeness 0). Use ‘getLong(…)’ office defined in tlpi_hdr.h header finish Compile using ‘gain portraiture_HW1’ in the ‘fileio’ directory abandoned in the fountain finish division of the textbook. Each plight (1 through 5 with unanalogous discussions) achieve be tested.

    Expert Repartee

     

    ***Please