|
problems with al_findfirst |
Mark Oates
Member #1,146
March 2001
|
I'm trying to do a simple search and list files in a directory. This is my code and for some reason it doesn't find any files: what am I doing wrong?
-- |
Synapse Jumps
Member #3,073
December 2002
|
Try specifying an absolute path, IE: "C:\*.htm", also, keep in mind these don't search recursively, so if you have folders IN whichever folder you're running this, it won't work properly. |
Evert
Member #794
November 2000
|
Quote: what am I doing wrong? What almost everyone does wrong : Quote: al_findfirst(search_criteria.c_str(), &info, 0) By passing 0, you are exclusing all files that have any attributes set (keep reading http://alleg.sourceforge.net/onlinedocs/en/alleg030.html until this makes sense). Pass FA_ALL instead (this is not documented in the 4.2 documentation due to an oversight, it is in SVN). The SVN documentation also has a less confusing description of what the flags do than the one in the current documentation. |
Mark Oates
Member #1,146
March 2001
|
Ah, twas the example in the documentation. FA_ALL is not diclared in the version I'm using - 4.2.0(beta3). so I did this: #define FA_ALL FA_RDONLY | FA_HIDDEN | FA_SYSTEM | FA_LABEL | FA_DIREC | FA_ARCH
(any I missed?) on a different note: -- |
|