file_size_ex(3alleg4)

πŸ’– file_size_ex β€” the Allegro manual, bestie edition πŸ’–

okay so real talk, this one lives in the Allegro game programming library manual. 3alleg4, section 3. yes we're doing manpage lore now, it's giving study group but make it cute. πŸŽ€


✨ NAME ✨

file_size_ex β€” returns the size of a file in bytes. Allegro game programming library. that's it, that's the whole job, and she does it flawlessly. πŸ‘‘


✨ SYNOPSIS ✨

#include <allegro.h>

uint64_t file_size_ex(const char *filename);

look at her. one include, one function, one const char *filename. clean. πŸ¦‹


✨ DESCRIPTION ✨

so basically: file_size_ex returns the size of a file, in bytes. that's the tea. β˜•

you hand her a filename, she hands you back a uint64_t and you go about your day.

but bestie, listen, there's a plot twist 🫢 β€” if the file does not exist, or if an error occurs, she doesn't yell at you, she just returns zero and quietly stores the system error code in errno. so like. if you get a 0 back, that's your cue to go check errno before you assume the file is just empty. iykyk. 😭

⚠️ note: a return value of zero does not automatically mean "empty file", it can also mean "file doesn't exist or something went wrong". the error code is in errno. don't get caught out, bestie, the vibes will betray you. πŸ’€

✨ SEE ALSO ✨


and that's the whole page!! main character energy from a function that just counts bytes. obsessed, honestly. 🌈

Allegro, version 4.4.3 β€” mwah, love that for us. signing off from the file_size_ex(3alleg4) corner of the Allegro manual πŸ’…βœ¨πŸŽ€πŸ¦‹