I have a folder called "test". I need a c++ code that helps me to print all the files from that folder. I don't want to use inotify or ls.
Asked
Active
Viewed 241 times
-2
-
possible duplicate of [How can I get a list of files in a directory using C or C++?](http://stackoverflow.com/questions/612097/how-can-i-get-a-list-of-files-in-a-directory-using-c-or-c) – INS Feb 02 '12 at 09:11
-
why is this not a real question? – just ME Feb 02 '12 at 10:34
-
it's a duplicate: http://stackoverflow.com/questions/612097/how-can-i-get-a-list-of-files-in-a-directory-using-c-or-c – INS Feb 03 '12 at 07:01
3 Answers
0
<dir.h>
Next time please do a minimum research by yourself before asking.

m0skit0
- 25,268
- 11
- 79
- 127
0
The solution I'd recommend is to use boost::filesystem
for reading the
directory (and manipulating paths), and boost::reg_ex
(or
std::reg_ex
if you have C++11) for checking which filenames match a
pattern.

James Kanze
- 150,581
- 18
- 184
- 329