Visual C the best way to get the contents of a file directory into a list

 Author How to get a list of files in a directory??
 aoie 2006-02-28, 7:59 am
What is the best way to get the contents of a file directory into a list?

 Bruno van Dooren 2006-02-28, 7:59 am

> What is the best way to get the contents of a file directory into a list?

The easiest is if you can use the .NET framework. Then you can use the
DirectoryInfo class, which can directly give you an array of contents.

with win32 you can use the FindFirstFile/FindNextFile enumeration functions.

For MFC CFindFile is maybe a good solution.

--

Kind regards,
Bruno.
bruno_nos_pam_van_dooren@hotmail.com
Remove only "_nos_pam"

aoie wrote:
> What is the best way to get the contents of a file directory into a list?

FindFirstFile("*.*")
FindNextFile
FindClose

and filter out "." and ".." entries which, most of the time, are of no
interest for you.

Arnaud
MVP - VC

aoie wrote:
> What is the best way to get the contents of a file directory into a list?

FindFirstFile("*.*")
FindNextFile
FindClose

and filter out "." and ".." entries which, most of the time, are of no
interest for you.

Arnaud
MVP - VC

 James Brown [MVP] 2006-02-28, 7:59 am

"aoie" <removethis4spam.rastacey@nl.rogers.com> wrote in message
news:du193k$6g6$1@emma.aioe.org...
> What is the best way to get the contents of a file directory into a list?
>
>

Take a look at the DlgDirList API

James

--
Microsoft MVP - Windows SDK
www.catch22.net
Free Win32 Source and Tutorials

 David D 2006-02-28, 7:07 pm
aoie wrote:
> What is the best way to get the contents of a file directory into a list?
>
>

For a platform independence take a look at Boost and it's Filesystem Library:
http://www.boost.org/libs/filesystem/doc/index.htm

/David