views:

281

answers:

3

Hello everyone! I am making an application in C++ for windows, and one of its prime functions has to be directory and file io (searching, creating, etc). I basically want to be able to recursively search directories, and most of all be able to get the file names in a directory. Then I want to be able to get the directory names in the current directory.

In C#, it is a breeze to implement this functionality, but I am using C++. I tried using the windows API for this, but you know how the WIN API can be a pain in the neck and takes a million lines of code just to get a simple thing done. :P

So what are some good libs for this?

Thanks

+14  A: 

Try the Boost.Filesystem library.

cjm
I highly recommend this library. Very easy to use
Maciek
+3  A: 

You can use SDK APIs Using FindFirstFile and FindNextFile. They are simple :)

MSDN Example: Listing the Files in a Directory

Apart from Boost suggested by @cjm, if you want to use MFC library:

Recursive file search using C++ MFC

aJ
A: 

You can use MFC'c CFindFile. WTL has also a port of CFindFile, it's located in atlmisc.h

Cristian Adam