469,295 Members | 1,928 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,295 developers. It's quick & easy.

listing files in a directory

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 ?

Jul 22 '05 #1
2 19302
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
kb******@gascad.at
Jul 22 '05 #2
-----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-----
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by xEM | last post: by
1 post views Thread by Sims | last post: by
7 posts views Thread by Jennica Humphrey | last post: by
1 post views Thread by Shawn Mehaffie | last post: by
3 posts views Thread by dougawells | last post: by
2 posts views Thread by Mike P | last post: by
2 posts views Thread by Jay Garland | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.