Output:
The first file found is LOG_09.TXT
Next file name is LOG_10.TXT
Next file name is LOG_11.TXT
Next fi (cut off word "file"?)
Function:
//Find last modified log file
hFind = FindFirstFile("..\\..\\LOGS\\LOG*.TXT", &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
printf ("FindFirstFile failed (%d)\n", GetLastError());
return;
}
else
{
printf("The first file found is %s<br>",FindFileData.cFileName);
//List all the other files in the directory.
while (FindNextFile(hFind, &FindFileData) != 0)
{
printf ("Next file name is %s<br>", FindFileData.cFileName); //NOT DISPLAYING ALL NAMES CONSISTENTLY??
}
dwError = GetLastError();
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES)
{
printf ("FindNextFile error. Error is %u.\n", dwError);
return (-1);
}
}
The word "file" is actually cut short in my printf. Sometimes it displays all the file names sometimes it displays a few, sometimes it doesn't even finish the printf quoted line, like shown above. What is causing this and am I being mislead by the printf functionality? In the debugger it looks like everything is OK, but I want to be certain and understand this. For example, I don't have a null char after i in file right? Why is it being cut off here? Thanks.
EDIT: Incorrect - Single threaded application library. (Was multithreaded before, sorry)
printing to a file gives the complete list of files while printf concurrently is "unstable". Not sure I understand why....