Program to read filenames in a directory
Posted on 2003-03-12
I am trying to write a code (using the vc++ compiler) to read the filenames in any given directory in the windows system and then write the list of filenames in a text file.
Suppose i have a directory "c:\temp" with the files a.txt,b.dll,c.jpg etc.
i give the program the directory to read as "c:\temp" , then i want my code to read the file names in this directory and then output a file list.txt containing the names of the files ( that is a.txt, b.dll, c.jpg.....)
I guess it will be a small piece of code but i do not know how to do it on windows.
[ i know it can be done on unix using opendir(),readdir() functions but these do not seem to be available in vc++ and do not know the equivalents]