fopen to open archive

This is a discussion on fopen to open archive within the C Programming forums, part of the General Programming Boards category; can you use fopen to open/read/write to archives? archives so as the command used in unix like "ar" example being: ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    91

    fopen to open archive

    can you use fopen to open/read/write to archives?

    archives so as the command used in unix like "ar"

    example being:
    ar -q myarchive file1.c file2.c file3.c file.4 file5.c

    and so forth.

    Trying to write a program that does the creations/modifications/extractions as ar.

    Thanks in advance.

    dlwls

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Yes. But you need to know and follow the internal structure of the archive.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    91
    Sounds great. Thanks.

  4. #4
    Registered User
    Join Date
    Oct 2008
    Posts
    91
    How about using dirent.h? Doing something like

    Code:
    dirp = opendir(".");
    
    while (dirp) {
        errno = 0;
        if ((dp = readdir(dirp)) != NULL) {
            if (strcmp(dp->d_name, name) == 0) {
                closedir(dirp);
                return FOUND;
            }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fopen and open
    By ygfperson in forum Linux Programming
    Replies: 2
    Last Post: 06-29-2005, 08:34 PM
  2. open, fopen ?
    By Matrim in forum C Programming
    Replies: 2
    Last Post: 02-01-2005, 08:45 AM
  3. open or fopen?
    By Tibo in forum C Programming
    Replies: 2
    Last Post: 03-27-2003, 09:14 AM
  4. fopen() and open()
    By Encrypted in forum C Programming
    Replies: 8
    Last Post: 02-09-2003, 03:57 PM
  5. fopen vs open
    By rotis23 in forum Linux Programming
    Replies: 5
    Last Post: 12-10-2002, 01:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21