al_fungetc(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_fungetc πŸ’–

okay bestie, so this is a page from the Allegro 5 manual β€” the al_fungetc one, specifically. sit down, grab a strawberry, and let's get into it πŸ“


✨ NAME ✨

al_fungetc β€” Allegro 5 API πŸ‘‘


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

int al_fungetc(ALLEGRO_FILE *f, int c)

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically it ungets a single byte from a file. like, you take a byte that was already read and you shove it back in there. and the pushed-back bytes? they are NOT written to the file, no ma'am. they just hang around, made available for the reads that come after β€” and in reverse order, because of course they do πŸ’…

the number of pushbacks you get depends on the backend, fr fr. the standard I/O backend only guarantees you a single pushback β€” and honestly even that depends on the libc implementation. so don't get greedy πŸ™ˆ

for backends that follow the standard behavior: the pushback buffer gets cleared after any seeking or writing. also, calls to al_fseek(3alleg5) and al_ftell(3alleg5) are relative to the number of pushbacks. and if a pushback makes the position go negative?? the behavior of al_fseek(3alleg5) and al_ftell(3alleg5) is undefined. not undefined in a cute mysterious way, undefined in a "we literally cannot tell you what happens" way πŸ’€

⚠️ heads up bestie: undefined behavior is not a vibe. if you're pushing back past the start of the file, you're on your own. proceed with caution 🫢

🌈 SEE ALSO 🌈


and that's the whole page, bestie πŸ’œ it's from the Allegro reference manual, and the footer was just doing its little al_fungetc(3alleg5) thing again β€” iconic of it honestly. mwah, go push some bytes back πŸŽ€βœ¨

πŸ“¦ where this page comes from