C++, console Application, reading files from directory
I have a directory and I want to read all the text files in it using C++ and having windows OS also using开发者_运维技巧 console application I don't know the files' names or their number thanks in advance
Take a look at Boost.Filesystem, especially the basic_directory_iterator
.
If you want the C++ and portable way, follow the solution by @Space_C0wb0y and use boost.Filesystem, otherwise, if you want to get your hands dirty with the Windows APIs, you can use the FindFirstFile/FindNextFile/FindClose functions.
You can find here an example related to them.
精彩评论