FindFirstFile and FindNextFile
Before I ask my question, yes I have done searches. I've gone through this board, google, MSDN, and still don't know what is happening.
I have part of my code checking to see if the program is in fact getting the file name, and it is not. I know this directory has only files, and no other directories. If I use FindFirstFile("*.*",&ffData) it will always return a directory for dwFileAttributes, and never give me a filename. If I use FindNextFile(".txt",&ffData) or something, it will then give me a file name. Why does "*.*" never return a file name?
Code:
_chdir("C:\\aaMyFiles"); //this is further up in the code
//from here down is all together
if((buffer = _getdcwd(3,lBuffer,MAX_PATH)) == NULL)
perror("_getcwd error");
hFind = FindFirstFile("*.*",&ffData);
if(ffData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY)
SetDlgItemText(Hwnd,TESTING,ffData.cFileName); //i never get the file name
else if(hFind == INVALID_HANDLE_VALUE)
SetDlgItemText(Hwnd,TESTING,"invalid handle"); //hasn't been a problem yet
else if (ffData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
SetDlgItemText(Hwnd,TESTING,buffer); //ALWAYS COMES TO THIS ONE
else
SetDlgItemText(Hwnd,TESTING,ffData.cFileName); //just in case, but still doesnt show a file name