I am a newer C++ user and very green to the win32 API. I have been looking at the MSDN ref site under "File Management Functions" but don't see a clear function for loading a directory. In my case I need to loop thru the files in a folder to check if the file I need is there or if I should create a new one. Reading and writing files I get, just not how to loop threw a folder. A simple practical example or a web site is welcome. Google has failed me or I'm not searching for the right keywords.

Second I'm not sure if this is a broad question but how do you detect "environment " folders like the users "my documents" folder or the "Program files" folder. I assume it might vary a cross the different versions of windows but my Google attempts were fruitless. Practice examples or a web link would be very welcome.

-Ryan