Mohamed
Mohamed

Reputation: 1597

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

Upvotes: 2

Views: 1789

Answers (2)

Matteo Italia
Matteo Italia

Reputation: 126827

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.

Upvotes: 1

Björn Pollex
Björn Pollex

Reputation: 76828

Take a look at Boost.Filesystem, especially the basic_directory_iterator.

Upvotes: 3

Related Questions