al_findfirst(3)
π NAME π
al_findfirst β the low-level function for searching files, straight out of the Allegro game programming library bestie π
β¨ SYNOPSIS β¨
#include <allegro.h>
int al_findfirst(const char *pattern, struct al_ffblk *info, int attrib);
πΈ DESCRIPTION πΈ
okay so al_findfirst is the low-level girlie that goes hunting for files for you π₯ She finds the first file that matches the wildcard specification you hand her, plus the file attributes you asked for (see above, iykyk). All the tea she finds about that file (if there even is one, no cap) gets dropped into the al_ffblk structure β and yes, you have to provide that structure yourself, she's not doing that for you π
The al_ffblk structure is giving:
struct al_ffblk
{
int attrib; - actual attributes of the file found
time_t time; - modification time of file
char name[512]; - name of file
};
There's some other stuff in the structure as well, but it is there for internal use only π like don't touch it, it's not for you.
Example time, periodt:
struct al_ffblk info;
if (al_findfirst("*.pcx", &info, FA_ALL) != 0) {
/* Tell user there are no PCX files. */
return;
}
β RETURN VALUE β
She returns non-zero if no match is found π or if an error occurred β and in that error case she sets errno accordingly, so check it, bestie.
She returns zero if a match IS found π and lowkey she allocates some memory for internal use inside that structure while she's at it.
π¨ THE IMPORTANT PART π¨ because she grabbed memory, you have to close your search when you are finished or you're gonna have memory leaks in your program fr fr. don't be that girlie.
π¦ SEE ALSO π¦
k bye ily, this was Allegro version 4.4.3 energy πβ¨ go close your searches, mwah ππ
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms