file_exists(3)
π file_exists(3) π
okay so bestie, we're in the Allegro manual today and this lil function is literally the "is it there tho??" detector. Allegro game programming library, obvi π
β¨ NAME β¨
file_exists β Tells if a file exists. Allegro game programming library.
πΈ SYNOPSIS πΈ
#include <allegro.h>
int file_exists(const char *filename, int attrib, int *aret);
π¦ DESCRIPTION π¦
So what it does is, it checks whether a file matching the given name and attributes (peep the beginning of this chapter for those, iykyk) actually exists. Like, does this thing exist or not, bestie, answer me.
And here's the cute part: if aret is not NULL, it gets set to the attributes of the matching file. Free intel. Obsessed. π
Example time, look at her:
/* Check for a normal file. */
if (file_exists("franken.dat", 0, NULL))
allegro_message("It is alive!\n");
not the "It is alive!\n" π iconic behavior fr fr.
β RETURN VALUE β
Returns non-zero if the file exists, or zero if it doesn't β or if the specified attributes mask it out. So zero is giving "nope, not here, or filtered out, either way not today". π
π SEE ALSO π
k that's the whole vibe, bestie β this page came from Allegro, version 4.4.3, so go forth and check your files π«Άβ¨π
π¦ 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