file_size_ex(3)

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

✨ file_size_ex(3) ✨

okay so bestie, welcome to the Allegro manual πŸ’– this one's a lil baby page but it's so useful, i promise. it's file_size_ex, and yes she's giving exactly what her name says. let's get into it 🫢


🌸 NAME 🌸

file_size_ex β€” returns the size of a file in bytes. it lives in the Allegro game programming library, aka the place where all the good stuff is πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

uint64_t file_size_ex(const char *filename);

like. one include. one function call. that's it. iconic behavior honestly πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so what does she do?? she returns the size of a file, in bytes. that's the whole vibe. you hand her a filename, she hands you back a uint64_t and you're like "omg thank you" 🌈

but here's the part you gotta know, no cap β€” if the file doesn't exist, or literally any error happens, she doesn't throw a fit and crash on you. nope. she returns zero and stores the system error code in errno. so if you get a 0 back, don't just assume "aw the file is empty i guess πŸ™ˆ" β€” check errno, bestie, because that 0 might be her politely telling you something went wrong 😭

lowkey the move: always check errno after a 0. it's giving "read the room" energy fr fr πŸ’€

πŸ’œ SEE ALSO πŸ’œ


that's the whole page, bestie, short and sweet like a lil strawberry πŸ“ go forth and check your file sizes responsibly ✨

signing off β€” this was Allegro, version 4.4.3, and the manual page is dated file_size_ex(3). mwah πŸ’‹ πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from