Listing dir
How can I get an array of strings containing all file names inside any directory?
Note: I'm using windows.
In C++, I would just use boost::filesystem. If not C++, then you might mention what language you are using.
well, i was a few minutes late in beating the MSDN example, but i came up with this:
it seems to work well, and may be a little simpler to read. btw: include windows.h.
EDIT: and you would want to store in a string instead of outputting, of course.
[Edited by - anist on August 16, 2004 12:07:53 AM]
void pwd(){ WIN32_FIND_DATA data; HANDLE first = FindFirstFile("*.*", &data); std::cout << data.cFileName << "\n"; while(FindNextFile(first, &data)) std::cout << data.cFileName << "\n";}
it seems to work well, and may be a little simpler to read. btw: include windows.h.
EDIT: and you would want to store in a string instead of outputting, of course.
[Edited by - anist on August 16, 2004 12:07:53 AM]
Quote:Original post by anist
well, i was a few minutes late in beating the MSDN example, but i came up with this:
*** Source Snippet Removed ***
it seems to work well, and may be a little simpler to read. btw: include windows.h.
EDIT: and you would want to store in a string instead of outputting, of course.
Wow, im going to use that. May way was so much more complicated.
Thanks
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement