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 ๐๐โจ
๐ฆ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 ยท Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 ยท Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 ยท Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 ยท Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 ยท Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 ยท Allegro-gift-ware
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms