C: theory on how to extract files from an archived file

Posted by donok on Stack Overflow See other posts from Stack Overflow or by donok
Published on 2010-12-22T15:13:23Z Indexed on 2010/12/22 15:55 UTC
Read the original article Hit count: 159

Filed under:
|

In C I have created a program which can archive multiple files into an archive file via the command line. e.g.

$echo 'file1/2' > file1/2.txt
$./archive file1.txt file2.txt arhivedfile
$cat archivedfile 
file1
file2

How do I create a process so that in my archivedfile I have:

header
file1
end
header
file2
end

They are all stored in the archive file one after another after another. I know that perhaps a header file is needed(containing filename, size of filename, start and end of file) for extracting these files back out into their original form, but how would I go about doing this.

I am stuck on where and how to start.

Please could someone help me on some logic as to how to approach extracting files back out of an archived file.

© Stack Overflow or respective owner

Related posts about c

    Related posts about homework