listing files in a directory

D

David Jacques

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 ?
 
K

Karl Heinz Buchegger

David said:
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
 
E

Evan Carew

-----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 said:
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-----
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,249
Members
46,845
Latest member
GygaKnight

Latest Threads

Top