C: theory on how to extract files from an archived file
- by donok
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.