I have a problem with WinApi. I need to process all files from a directory. I am not sure if I am using this api calls correctly, but findNextFile doesn’t seem to work. Here is the sample code: // This works ok, i gets some number (possibly file handle), and str1 gets filename [i, str1] = WinApi::findFirstFile(fileName); // This doesn’t work, resulting in str1 = ‘’ str1 = WinApi::findNextFile(i);
Hi Bojan, You must set the filename as a range of files (ex. : “C:\TEST\.”). Then you can proceed like this: [i, str1] = WinApi::findFirstFile(fileName); while (WinApi::findNextFile(i)) { str1 = WinApi::findNextFile(i); } However, it only gets a part of them, not all (I don’t undestand why). Regards, CD
Hi Bojan, I encountered the same problem, but I solved it by making a wildcard for the find first file, then making a “dummy” FindNextFiles (to get past the . and … which are the first two files in a directory see example below: files = WinApi::findFirstFile(filepath + ‘\*’); WinApi::findNextFile(conpeek(files,1)); filname = WinApi::findNextFile(conpeek(files,1)); while (filnavn != ‘’) { IOFile = new AsciiIo(filepath + ‘\’ + filname,‘R’); . . }
10x John.fo & Mugur I have found the use of winapi in some other language on internet, but didn’t know that the forum has moved. 10x again [:)]