|
-
January 27th, 2003, 10:49 AM
#1
FindFirstFile() question
Hi, I've been trying to use the FindFirstFile function for reading files from a given input directory. basically, at the command line I write:
ProcessTextFiles "c:\data\*.txt"
so that I pass in the directory string as shown above. Now, when I run the code snippet below, it seems to correctly go the directory I want and step through the .txt files one at a time but in the returned structure
WIN32_FIND_DATA fileData;
I can see that you can retrieve the current filename (i.e., with cFileName method) but only without the path. How can I used FindFirstFile in a way where I can get the entire path:
for example:
"c ata\gg1.txt"
vs just
"gg1.txt"
??
Thanks!
if ((hFileRead = FindFirstFile(argv[1], &fileData)) != INVALID_HANDLE_VALUE){
do{
string FilenameWithFullPath = fileData.cFileName;
//Process this next text file
BuildDictionary.ProcessTextFile(FilenameWithFullPath);
}while (FindNextFile(hFileRead, &fileData));
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|