listing files in a directory

Discussion in 'C++' started by David Jacques, Nov 8, 2004.

  1. I am trying to get a list of all files of a certain extension type on disk
    to do some processing in a loop. The code needs to be portable to UNIX, so
    I need to use plain C++ functionality. Does anyone know of a way to do this
    ?
    Any URLs, code snippets, etc ? Is this even possible ?
    David Jacques, Nov 8, 2004
    #1
    1. Advertising

  2. David Jacques wrote:
    >
    > I am trying to get a list of all files of a certain extension type on disk
    > to do some processing in a loop. The code needs to be portable to UNIX, so
    > I need to use plain C++ functionality. Does anyone know of a way to do this
    > ?
    > Any URLs, code snippets, etc ? Is this even possible ?


    This is not possible.
    Plain C++ has no functionality to access a file system so your code
    will be non-portable anyway.

    But there is light: boost has encapsulated file system functions
    for various operating systems in a consistent way.
    www.boost.org


    --
    Karl Heinz Buchegger
    Karl Heinz Buchegger, Nov 8, 2004
    #2
    1. Advertising

  3. David Jacques

    Evan Carew Guest

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    David,

    Try Boost's filesystem library. It most likely has the filesystem
    primitives you need in the portable format you want.

    http://www.boost.org/libs/filesystem/doc/index.htm

    Evan

    David Jacques wrote:
    > I am trying to get a list of all files of a certain extension type on disk
    > to do some processing in a loop. The code needs to be portable to UNIX, so
    > I need to use plain C++ functionality. Does anyone know of a way to do this
    > ?
    > Any URLs, code snippets, etc ? Is this even possible ?
    >
    >
    >


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.0.6 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iD8DBQFBj7CXoo/Prlj9GScRAh2rAJ9wlqI4UtKQFn3oRKRDWvUHEMCrxQCfVKku
    nO+tD/tCdMM3K8Ekff1rrG0=
    =8Oy0
    -----END PGP SIGNATURE-----
    Evan Carew, Nov 8, 2004
    #3
    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. Jennica Humphrey
    Replies:
    7
    Views:
    3,510
    Evan Carew
    Jan 29, 2004
  2. Piyush
    Replies:
    2
    Views:
    416
    John Harrison
    Aug 2, 2004
  3. Replies:
    4
    Views:
    4,362
    Real Gagnon
    Jan 25, 2007
  4. David Jacques

    listing all files in a directory

    David Jacques, Nov 8, 2004, in forum: C Programming
    Replies:
    3
    Views:
    402
    SM Ryan
    Nov 8, 2004
  5. Jrdman

    problem listing files in a directory

    Jrdman, Jul 2, 2008, in forum: C Programming
    Replies:
    4
    Views:
    293
    rahul
    Jul 3, 2008
Loading...

Share This Page