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

http://www.codecomments.com/archive371-2006-2-825947.html

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"

adebaene@club-internet.fr

2006-02-28, 7:59 am


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

adebaene@club-internet.fr

2006-02-28, 7:59 am


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
Sponsored Links




posted on 2006-09-17 10:28  cy163  阅读(...)  评论(...编辑  收藏

导航