Jump to content
  • Advertisement
Sign in to follow this  
guyaton

files in a directory

This topic is 4864 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how do i get a list of files in a directory (windows) in c++ preferably not using MFC because this will be in a .dll file. i just want to see what files are there, look for certain extensions and possibly recurse through child directories. ~guyaton

Share this post


Link to post
Share on other sites
Advertisement
Here is an example how to use it (not including error checking):
WIN32_FIND_DATA fd;//contains properties of the file
HANDLE hf = FindFirstFile (dirpath, &fd);//finds the first file in the directory
FindNextFile (hf, &fd)//find next file in directory
*The files that these functions retrieve can also be directories.
*FindNextFile returns NULL when there are no more files.
*The order which the files are retrieved is not sorted (at least i think so because when i used it i found no sorting, even the directories were mixed with the files, there weren't seperated to two groups).
Oh and by the way when using MFC you can include as a static linked library in the project settings and then you need to use no DLL.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!