file_exists(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– 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