Feb 14, 2020 at 11:27am UTC
What I want is to get the list of filenames in a directory. I'm using windows. Apparently
shows the list of files. But I don't need to show them, just get them in a string array. How can I do this?
Feb 14, 2020 at 11:49am UTC
The first question is what IDE are you using and do you know what C++ standard the compiler is using?
In C++14 you have "experimental/filesystem" and in C++17 just "filesystem". Not familiar with these, so I do not know if this will do what you want.
Another option will send the output if "dir" to a file that you can read and work with.
"dir | fileName.txt")
Feb 14, 2020 at 12:03pm UTC
My apologies. It has been awhile and I thought the pipe was the proper character. turns out it is ">".
After testing this may work for you. . This listed just the file names in the directory.
"dir /B > fileName.txt")