Archived

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

Which files are in a folder? (C++ Question)

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

(This may sound basic, but I looked through MSDN for hours and found NOTHING.) In Windows C++, how can I create an array containing the filenames of all the files in a given directory?

Share this post


Link to post
Share on other sites
Quick search of MSDN..

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/storage_2kft.asp

This example shows you how to find files in a directory and display the filenames to the screen. You can easily store these in a stl string array, and resize the array everytime a new file is found. That's how I would do it.

[edited by - Coaster Kev on August 17, 2002 4:04:15 PM]

Share this post


Link to post
Share on other sites
boost has a directory iterator as well

Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]

[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]

Share this post


Link to post
Share on other sites