문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top