• Advertisement

Archived

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

directory listing in c++

This topic is 6560 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

I need to get a list of all the files in a directory, how can I accmoplish this through c++. ( I am using MSVC 5.0 and this is a win application ) - OneEyeLessThanNone

Share this post


Link to post
Share on other sites
Advertisement
If you want to use MFC, you can do this fairly easily using a CListBox::dir() function.

If you do not wish to use MFC, the regular windows way to do this is to use the FindFirstFile and FindNextFile() in a loop. You can specify wildcards in your search, so using the "*.*" method to find all files in a directory will work. You will also need to watch for subdirectories, as those will also appear in the search.

good luck


*oof*

Share this post


Link to post
Share on other sites
Maybe you can use GetOpenFileName() (look it up in the msdn). It''s a common dialog control and I use it all the time.

But then again, it might not be suited for you because you are doing your own gui style thingy.

Jaap Suter

Share this post


Link to post
Share on other sites

  • Advertisement