pack_fseek(3)

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

πŸ’– pack_fseek(3) β€” the Allegro manual, but make it cute πŸ’–

okay bestie, we're diving into the Allegro game programming library, and this little function is called pack_fseek. It's a section 3 manpage situation, so pull up a chair and let's go 🫢


✨ SYNOPSIS ✨

#include <allegro.h>

int pack_fseek(PACKFILE *f, int offset);

🌸 DESCRIPTION 🌸

So basically? pack_fseek moves the position indicator of the stream f. That's it. That's the whole vibe. πŸ’…

But here's the tea, and it's important tea: unlike the standard fseek() function, this one only supports forward movements relative to the current position, and only in read-only streams. So do not come in here with negative offsets, okay? Not the move. πŸ™ˆ

Also, real talk: seeking is very slow when you're reading compressed files. Like, painfully slow. So you should avoid it unless you are sure that the file is not compressed. No cap. πŸ”₯

Here's an example, iconic behavior honestly:

input_file = pack_fopen("data.bin", "r");
if (!input_file)
   abort_on_error("Couldn't open binary data!");
/* Skip some useless header before reading data. */
pack_fseek(input_file, 32);

⭐ RETURN VALUE ⭐

Returns zero on success, or a negative number on error β€” and when it errors, it stores the error code in errno. So check that errno, bestie, she's trying to tell you something. 😭


πŸŽ€ SEE ALSO πŸŽ€


πŸ’€ reminder reminder: forward only, read-only streams only, no negative offsets, and compressed-file seeking is slow slow slow. periodt.

okay that's the whole page, you ate that 🧚✨ this was the Allegro manual, version 4.4.3 β€” mwah, love you, go write some games πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from