E1M1 Posted August 5, 2010 Share Posted August 5, 2010 Is it just FindNextFile? or something other? I tried to list files with C++. hFind = FindFirstFile(token, &FindFileData); do{ _tprintf (TEXT("File Found: %s\n"),FindFileData.cFileName); }while(FindNextFile(hFind, &FindFileData)); FindClose(hFind); but it doesn't seem to work. With "C:\users\rain" it says what you can see below, but actually I have many files and folders in C:\Users\rain. C:\Users\rain>D:\Development\Cplusplus\del\del2\Debug\del2.exe C:\users\rain File Found: rain C:\Users\rain> Iam just wondering if there's any alternative methods. edited Link to comment Share on other sites More sharing options...
danielkza Posted August 5, 2010 Share Posted August 5, 2010 (edited) I think you need to suffix a folder name with a wildcard (*.*) to list its contents. AutoIt probably does that automatically before doing the actual call. Edited August 5, 2010 by danielkza Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 5, 2010 Share Posted August 5, 2010 The AutoIt source is at the download page.Is it just FindNextFile? or something other?Why would it be something other when AutoIt give the exact same result? @danielkzaYou make no sense. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
danielkza Posted August 6, 2010 Share Posted August 6, 2010 The AutoIt source is at the download page. Why would it be something other when AutoIt give the exact same result? @danielkza You make no sense. I wouldn't be surprised if AutoIt did some processing on the string before passing it to the actual API calls. Apparently, that isn't the case: a FileFindFirstFile search, when passed a string without wildcards, returns it as the single result. All that doesn't change the fact that if you want to list directory contents, you need to append an actual wildcard to the pattern. You can check it yourself: ConsoleWrite("=== FileFindFirstFile('C:\') ===" & @CRLF) $hSearch = FileFindFirstFile("C:\") $File = FileFindNextFile($hSearch) While Not @error ConsoleWrite($File & @CRLF) $File = FileFindNextFile($hSearch) WEnd ConsoleWrite("=== FileFindFirstFile('C:\*.*') ===" & @CRLF) $hSearch = FileFindFirstFile("C:\*.*") $File = FileFindNextFile($hSearch) While Not @error ConsoleWrite($File & @CRLF) $File = FileFindNextFile($hSearch) WEnd Link to comment Share on other sites More sharing options...
E1M1 Posted August 6, 2010 Author Share Posted August 6, 2010 hey it worked. thanks alot edited Link to comment Share on other sites More sharing options...
GEOSoft Posted August 6, 2010 Share Posted August 6, 2010 $hSearch = FileFindFirstFile("C:\*.*") can also be $hSearch = FileFindFirstFile("C:\*")There is an old windows bug that makes it ignore the last dot astrick George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now