1

which function windows is calling to list the files in a directory ?

thanks

2 Answers2

4

You can use this functions to do a directory listing with the WIN32 API.

FindFirstFile, FindNextFile and FindClose

A full example can be found here

Listing the Files in a Directory WIN32 API

For a portable approach check this post:

"Get list of files in a directory using c/c++"

Community
  • 1
  • 1
jitter
  • 53,475
  • 11
  • 111
  • 124
0

Didn't exactly get your question but won't using "dir" as system command do the job? Correct me if I am wrong, coz the question itself wasn't very clear to me.

Edit - Hi John, this is the source code for listing directories.

http://msdn.microsoft.com/en-us/library/aa365200(VS.85).aspx

Hope this helps.

Elitecoder
  • 170
  • 1
  • 13
  • I will be able to answer better if the question becomes clearer to me so if someone understands the question better, can they please edit it? – Elitecoder Jun 21 '09 at 15:47
  • Hey, in other words, im looking for the function that dir is using to list the files in a dir thanks –  Jun 21 '09 at 15:48