I've managed to get rename file/directory to work and some other API stuff I've used (console program so far), but FindNextFile is mystifying. I've read every example of code I can find and it's simple. Note: I do not wish to copy other peoples programs or sections verbatim but program it as I would do. I have a suspicion it might have something to do with TCHAR as most datatypes mystify me still (assemble programmer at heart).
***********************************
Code:#include <stdio.h> #include <windows.h> #include <string.h> #include <tchar.h> int main(int argc, char *argv[]) { WIN32_FIND_DATA myfind; HANDLE hfd; int x; DWORD dx = 200; TCHAR currdir[300]; char szer = {0}; char nl = {10}; char bslsh[2] = {92, 0}; x = GetCurrentDirectory(dx, currdir); printf("currdir at run time %s %c", currdir, nl); currdir[0] = szer; currdir[1] = szer; lstrcat (currdir, "C:"); lstrcat (currdir, bslsh); lstrcat (currdir, "Documents And Settings"); lstrcat (currdir, bslsh); lstrcat (currdir, "jlewandowsk2"); lstrcat (currdir, bslsh); lstrcat (currdir, "*"); printf("DIR built %s %c", currdir, nl); x = SetCurrentDirectory(currdir); x = GetCurrentDirectory(dx, currdir); printf("SET DIR %s %c", currdir, nl); printf("%c", nl); myfind.cFileName[0] = szer; hfd = FindFirstFile(currdir, &myfind); printf("handle %d ", hfd); printf("FIRST file-dir %s %c", myfind.cFileName, nl); while ( FindNextFile (hfd, &myfind) ) { printf("while loop %c", nl); printf("NEXT file-dir %s %c", myfind.cFileName, nl); } FindClose(hfd); getchar(); return 0; }



LinkBack URL
About LinkBacks



