-
Question
If there a way to scan a folder for names that are in .txt format that you do not know the name for. i use c++ borland vrs 5. and i would like to know how to do this. if you need any detailed info about this question send me an e-mail.
___________________________
when candy is made so is a smile :D
-
If you want to scan for filenames then use the windows functions FindFirstFile and FindNextFile.
eg, get all .txt files in the c:\ directory
Code:
#include <windows.h>
#include <iostream.h>
int main(void)
{
WIN32_FIND_DATA file;
HANDLE nextfile;
BOOL res;
// get info on a file
nextfile = FindFirstFile("c:\\*.txt", &file);
do
{
cout << file.cFileName << endl;
// get info on next file
res = FindNextFile(nextfile, &file);
} while(res);
return 0;
}