0

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

QAH
  • 4,040
  • 12
  • 41
  • 51

3 Answers3

15

Try the Boost.Filesystem library.

cjm
  • 60,701
  • 9
  • 123
  • 173
3

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

Community
  • 1
  • 1
aJ.
  • 33,420
  • 21
  • 82
  • 127
0

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

Cristian Adam
  • 4,689
  • 20
  • 18