Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions

Question

6. Effectively perform the managers role in career management.

Answered: 1 week ago