Manual Reference Pages - FOR_EACH_FILE_EX (3)
for_each_file_ex - Executes callback() for each file matching a wildcard. Allegro game programming library.
int for_each_file_ex(const char *name, int in_attrib, int out_attrib,
int (*callback)(const char *filename, int attrib,
void *param), void *param);
Finds all the files on disk which match the given wildcard specification
and file attributes, and executes callback() once for each. Basically, this
is a convenient wrapper around al_findfirst(), al_findnext() and
al_findclose(). in_attrib is a bitmask specifying the attributes the
files must carry, out_attrib is a bitmask specifying the attributes the
files must not carry; attributes which are not specified in either bitmasks
are not taken into account for deciding whether callback() is invoked or
The callback function will be passed three arguments: the first is a string
which contains the completed filename (exactly the same string you passed
to for_each_file_ex() but with meta characters), the second is the actual
attributes of the file, and the third is a void pointer which is simply a
copy of param (you can use this for whatever you like). The callback must
return zero to let the enumeration proceed, or any non-zero value to stop
it. If an error occurs, the error code will be stored in errno but the
enumeration wont stop. Example:
int show_name(const char *filename, int attrib, void *param)
allegro_message("Caught %s, attribs %d\n",
count = for_each_file_ex("data/level*", FA_DIREC,
0, show_name, 0);
allegro_message("%d game directories\n", count);
Returns the number of successful calls made to callback(), that is, the
number of times callback() was called and returned 0.
|Allegro ||FOR_EACH_FILE_EX (3) ||version 4.4.2 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.