Directory Listing

This is a discussion on Directory Listing within the C++ Programming forums, part of the General Programming Boards category; How can I get a listing of all files in a directory in Windows. I want to use the smallest ...

Directory Listing

How can I get a listing of all files in a directory in Windows. I want to use the smallest amount of header files and the least amount of code possible, if there's a portable method that'd be great but if it has to be windows specific that's ok. Thanks

Cool. Thanks much, maybe now i can finish my DND Tools, I needed this to be able to load races, classes, etc. dynamicaly(sp?) from a folder. Ex. Resources\Races\ would cantain a text file for each race and you could add to and edit them from those files. Want a new race just add in a new file with the races attributes, etc. Any Roleplaying fans?

Just wanted to point out that when you're checking the file attributes, you should say:
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
rather than
if(wfd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
because fileattributes is a set of flags and may contain the FILE_ATTRIBUTE_DIRECTORY flag but not be equal to it.