#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    3
    Rep Power
    0

    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.
  2. #2
  3. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,109
    Rep Power
    1802
    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 (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
    file handling, and how to process command line arguments and how to obtain file attributes
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    3
    Rep Power
    0
    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.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    186
    Rep Power
    82
    For some strange reason I cant open the TAR format link you posted.
    Here is a link to the tar file format

IMN logo majestic logo threadwatch logo seochat tools logo