December 17th, 2012, 02:22 PM
Much needed help
Hi, all I'm trying to better my understanding of C by creating small programs, I've created quite a few recently and now I am looking to create a command line archiving program which extracts files similar to the Unix tar program. Have no idea on how I should go about this, help is much appreciated.
December 17th, 2012, 02:50 PM
It is not clear what you want to do. Do you need an archive tool or an extraction tool - one is the opposite of the other?
If you intend to create both, then you can use an existing format or invent your own (somewhat pointlessly perhaps, but possibly useful academically).
For existing formats, take a look at http://www.wotsit.org/ it has details of the TAR format and may others.
Essentially an archive file is simply a way of collating the content of several files into a single file with metadata included that will allow the file content to be distinguished and later separated into the original separate files with the original names and attributes.
So thinks you may need to know about include:
file handling, and how to process command line arguments and how to obtain file attributes
- file handling (open, read, write)
- OS calls to obtain and set file attributes
- OS calls to iterate a folder or directory
- filename wild card matching
- command line argument processing
- data structures
December 17th, 2012, 03:09 PM
Sorry about the mix up, the main objective is to create an archiving program in C. Then I would like to extract the files in the archive from the command line into a given directory. Hope you understand what I mean.
For some strange reason I cant open the TAR format link you posted.
December 17th, 2012, 04:57 PM
Here is a link to the tar file format