Question

in C++, what would be the best way to list all files of a directory on Windows?

On Linux or on Windows using gcc (e.g. MingW) this is easy possible with dirent.h, but what's the best way to do it on Windows when dirent.h is not available (e.g. Visual Studio)?

Should I force people do add a freely available implementation of dirent.h to their Visual Studio? Or should I write an alternative code for reading the files? If this, what would be the best code to do so?

Thanks.

Was it helpful?

Solution

Something like Boost Filesystem would work across all of those situations.

OTHER TIPS

dirent.h is a POSIX header. On Windows you use the Find*File*() functions in the Win32 API.

To add to the answer above, Windows API is accessed via the windows.h header file included.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top