Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions