Advertisement

directory listing in c++

Started by March 08, 2000 09:46 AM
3 comments, last by OneEyeLessThanNone 24 years, 6 months ago
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
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*
*oof*
Advertisement
Thanks, gonna have to try that out when I get home, 2.5 hours left till my next class, and nothing to do.

"complexity killed the cat" - someone
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
____________________________Mmmm, I''ll have to think of one.
Yup, I''m implementing my own gui. Don''t know much MFC or other windows stuff, I will if I end up making utils.

This topic is closed to new replies.

Advertisement