Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an archiving utility in C that allows you to create an archive, and add, remove, list, and extract files. Let's call our archiving tool

Write an archiving utility in C that allows you to create an archive, and add, remove, list, and extract files. Let's call our archiving tool stuffy.

Here are some usage examples that should work: ./stuffy -a mystuffyarchive somefile stuffy adds the file somefile to the mystuffyarchive archive file. Subsequent calls to add to the same archive should result in additional files being added to the archive. If a file with the same name as somefile is already in the archive, exit and let the user know that a file with the same name is already in the archive, suggest that the existing file should be removed before adding the new file.

./stuffy -r mystuffyarchive somefile somefile should be removed from mystuffyarchive, if a file with such a name exists in the archive, otherwise let the user know that somefile was not found. Removal of files should result in an archive whose size reflects the removal (i.e. if I have an archive file whose size is 1000 bytes and I remove a 200 byte file from it, the new size of the archive should be smaller than 800, since you'll also remove the metadata for the removed file).

./stuffy-l mystuffyarchive stuffy should list the names and sizes (in bytes) of the files stored in the specified archive. Last line of output should print the total size of all files in the archive. ./stuffy -e mystuffyarchive somefile > someotherfile stuffy should extract data of the named file from the archive to stdout, which is then redirected to someotherfile. Careful not to overwrite something you can't live without. Extracting is NOT the same as removing. An extracted file's data should remain in the archive.

stuffy should work with both text and binary files. Do not use printf to extract to stdout.

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

Structured Edp Auditing

Authors: Gabriel Rothberg

1st Edition

0534979319, 978-0534979317

More Books

Students also viewed these Accounting questions

Question

Determine the distribution function of min0yt X(y).

Answered: 1 week ago