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

Started by
1 comment, last by rjahrman 21 years, 8 months ago
(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?
Advertisement
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]
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)]
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement