Question: Create a program that uses two command line parameters as follows ( in order ) : - Filename - Chunk size in Byte Your program

Create a program that uses two command line parameters as follows (in order):
-Filename
-Chunk size in Byte
Your program should open the file if it is there and read the entire chunk into memory based on the chunk size requested. The content in memory will then be written to a new file starting with '.0', i.e., for multiple chunks due to file size, your program should generate multiple files as 'filename.0', 'filename.1',...
Add sanity checks for your program and create a makefile.
A 447,961 byte file split into 100 kB (note 100 kB vs kiB) results in 5 files, the last one 47961 B in size.
Hint:
You will need to first reserve the memory before reading into it - malloc and calloc are your friends - and you should free the memory afterwards and close all resources / descriptors when done.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!