Sign in to follow this  
LukeSkyRunner

Listing dir

Recommended Posts

well, i was a few minutes late in beating the MSDN example, but i came up with this:


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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this