g++: How do I access a list of all files in a folder?

Discussion in 'C++' started by Jacob Voytko, Dec 1, 2004.

  1. Jacob Voytko

    Jacob Voytko Guest

    I am working with a group to write a program that organizes mp3 files
    in a root folder based on tag criteria. The tag readers are written,
    we are having trouble finding g++ documentation on reading all files
    in a folder, and deciding which files are mp3's. Any help will be
    appreciated.
     
    Jacob Voytko, Dec 1, 2004
    #1
    1. Advertising

  2. Jacob Voytko wrote:
    > I am working with a group to write a program that organizes mp3 files
    > in a root folder based on tag criteria. The tag readers are written,
    > we are having trouble finding g++ documentation on reading all files
    > in a folder, and deciding which files are mp3's. Any help will be
    > appreciated.


    news:gnu.g++.help
    news:comp.os.<your_os_here>.*

    V
     
    Victor Bazarov, Dec 1, 2004
    #2
    1. Advertising

  3. just use the standard C function readdir()
    the best thing about c++ is, you an use almost all th C-Libraries that have been developped ever since K&R invented C

    Thomas
     
    Thomas Ruschival, Dec 1, 2004
    #3
  4. Thomas Ruschival wrote:
    > just use the standard C function readdir()


    There no such standard C function. Perhaps you're considering the library
    you have for programming your OS as standard. It isn't.

    > the best thing about c++ is, you an use almost all th C-Libraries that have been developped ever since K&R invented C


    That's only true if you use an object-file compatible compiler.

    V
     
    Victor Bazarov, Dec 1, 2004
    #4
  5. Jacob Voytko wrote:

    > I am working with a group to write a program that organizes mp3 files
    > in a root folder based on tag criteria. The tag readers are written,
    > we are having trouble finding g++ documentation on reading all files
    > in a folder, and deciding which files are mp3's. Any help will be
    > appreciated.


    What's a folder? <g>

    - J.
     
    Jacek Dziedzic, Dec 1, 2004
    #5
  6. Jacob Voytko

    Jacob Voytko Guest

    Gracias, seƱor
     
    Jacob Voytko, Dec 2, 2004
    #6
  7. Jacob Voytko

    Jerry Coffin Guest

    Thomas Ruschival <> wrote in message news:<20041201225355.082fc7a5@Woody>...
    > just use the standard C function readdir()


    While readdir is in a standard, it's in the POSIX standard, not the C
    standard.

    > the best thing about c++ is, you an use almost all th C-Libraries that have
    > been developped ever since K&R invented C


    C was invented and in wide use for a LONG time before readdir was
    invented (before System V or so, directories also followed the UNIX
    dictum that everything be treated as files -- a directory was just a
    file full of structures of a specific type).

    While Brian Kernighan helped write the original book on C, he did not,
    by all accounts, help to invent the language -- if you were going to
    give credit to anybody but Dennis Ritchie, possibilities might include
    Ken Thompson (invented B, C's progenitor as well as the UNIX system to
    which C was so closely bound, early on), Martin Richards (inventor of
    BCPL, the progenitor of B) and/or Doug McIlroy (apparently invented
    C's preprocessor, among many other things).

    Though I wasn't present at the time, so my opinion should be taken
    with a grain of salt, my own nomination in this category would
    probably be Doug McIlroy -- reading books, papers, etc., it seems to
    me like he influenced nearly every part of early UNIX and
    (particularly) may have been one of the most careful about getting
    things _right_ rather than "close enough."

    --
    Later,
    Jerry.

    The universe is a figment of its own imagination.
     
    Jerry Coffin, Dec 2, 2004
    #7
  8. Jacob Voytko

    Ron Natalie Guest

    Jerry Coffin wrote:

    >
    > C was invented and in wide use for a LONG time before readdir was
    > invented (before System V or so, directories also followed the UNIX
    > dictum that everything be treated as files -- a directory was just a
    > file full of structures of a specific type).


    And it still is (actually, the more modern ones have variable length
    things in it). Readdir just knows how to parse the directory file.

    If I remember correctly, the original directories were just the
    following:
    struct {
    unsigned short ino;
    char name[14];
    };
    repeated.

    When a file was removed, it just wrote zero to the ino member.
    This led to an activity of artfully creating and deleting files
    so that when you did something like:

    cat /tmp

    after some initial garbage for the files that were actually in use
    there would appear a few new lines and some sort of ASCII-art picture.
     
    Ron Natalie, Dec 2, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ABC
    Replies:
    7
    Views:
    821
  2. Replies:
    4
    Views:
    2,143
  3. Replies:
    7
    Views:
    398
    Gabriel Genellina
    Sep 25, 2007
  4. Moiz

    Loading all files in a folder to a grid

    Moiz, Feb 25, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    95
    Darren Kopp
    Feb 27, 2006
  5. savvy
    Replies:
    3
    Views:
    240
    John Blessing
    Feb 10, 2006
Loading...

Share This Page