Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

GaMe wIg

File Listing...

This topic is 5742 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 you list all the files in a directory using C/C++? OR How do you open the standard Windows Open Dialog Box?

Share this post


Link to post
Share on other sites
Advertisement
To get all the files in a Dir you use the FindFirstFile() and FindNextFile() functions, look them up on msdn, and to open the standard dialog you use the getopenfilename()\getsavefilename() functions... eg heres some source riped striaght out of my current project
  
OPENFILENAME ofn;
char szFile[300] = {''\0''};

ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = App.CWindows.hMain;;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "NewsAgent Project *.prj\0*.prj\0All *.*\0*.*\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = 0;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

if(!GetOpenFileName(&ofn)) break;

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!