pack_fgets(3)
π pack_fgets(3) β the Allegro manual, but make it cute π
okay bestie, welcome to the Allegro manual, section 3 (that's the library functions girlies β¨). today's main character is pack_fgets, and she's here to read you a whole entire line. periodt.
β¨ NAME β¨
pack_fgets β reads a line from the stream. it's giving Allegro game programming library energy π
πΈ SYNOPSIS πΈ
#include <allegro.h>
char *pack_fgets(char *p, int max, PACKFILE *f);
π¦ DESCRIPTION π¦
so basically, this function reads a line from the stream f, and stores it at the location pointed to by p. iconic behavior, no cap.
it stops when it hits a linefeed, or when max bytes have been read β whichever comes first, and honestly same.
the end of line is handled by detecting the right combination of characters for the platform. she's multilingual, she's cultured π . she supports:
- CR-LF (DOS/Windows)
- LF (Unix)
- CR (Mac)
formats. however!! the trailing carriage return is not included in the returned string, and that's on purpose β it's so your code stays easy to port across platforms. it's giving cross-platform queen. if you actually need that carriage return, use pack_fread() and/or pack_getc() instead. iykyk.
π Note: this function internally may make calls topack_ungetc, so you cannot usepack_ungetcdirectly afterwards. like, she already used it, bestie. it's taken. π
Example:
char buf[256];
...
while (pack_fgets(buf, sizeof(buf), input_file)) {
/* Process input line. */
}
fclose(input_file);
look at her looping like that π ate and left no crumbs.
π RETURN VALUE π
returns the pointer p on success π, or NULL on error π.
π SEE ALSO π
and that's the whole page, bestie! this lil' section of the Allegro manual is from version 4.4.3, and you've been reading pack_fgets(3) π«Ά go read a line, slay, and remember: no trailing carriage returns in this house. bye bestie!! πβ¨πΈ
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms