file_exists(3alleg4)

๐Ÿ’– file_exists(3alleg4) โ€” the Allegro manual, but make it cute ๐Ÿ’–

okay bestie, welcome to the Allegro manual โœจ this one is file_exists, and yes it does exactly what it says on the tin: it tells you if a file exists. Allegro game programming library represent ๐ŸŽฎ๐Ÿ‘‘


โœจ SYNOPSIS โœจ

#include <allegro.h>

int file_exists(const char *filename, int attrib, int *aret);

๐ŸŒธ DESCRIPTION ๐ŸŒธ

So like, this function checks whether a file matching the given name and attributes exists (the attributes situation is explained at the beginning of this chapter, go peek if you need the lore ๐Ÿ“–).

And here's the lil bonus: if aret is not NULL, it gets set to the attributes of the matching file. Not me handing you extra info for free ๐Ÿ’…

Example time, look at this:

/* Check for a normal file. */
if (file_exists("franken.dat", 0, NULL))
   allegro_message("It is alive!\n");

it's giving Frankenstein but make it a file check ๐ŸงŸโ™‚๏ธโœจ obsessed honestly


โญ RETURN VALUE โญ

Returns non-zero if the file exists ๐ŸŽ‰ or zero if it doesn't โ€” or if the attributes mask you specified just filters it out. rude but valid, iykyk ๐Ÿ˜ญ


๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

go read those too, they're the friend group fr fr ๐Ÿซถ


heads up bestie: that "(see beginning of this chapter)" note about attributes is a real thing, not a bit โ€” the attribute flags live earlier in the chapter and you're gonna wanna know them before you start throwing numbers into attrib ๐Ÿ’€

and that's the whole page, no cap ๐Ÿ’– this was Allegro, version 4.4.3, and this little manual moment is dated right there in the footer. slay, go check some files, periodt ๐ŸŒˆ๐Ÿ‘‘โœจ