gd_frameoffset(3)

πŸ’– gd_frameoffset(3) β€” the getdata girlie's guide πŸ’–

okay so bestie, welcome to gd_frameoffset(3), a lil function from the GETDATA manual. It's giving "where does my data actually start" energy, and honestly? Iconic. Let's get into it. πŸ¦‹


✨ NAME ✨

gd_frameoffset β€” report the starting frame of fields in a Dirfile 🌸


πŸŽ€ SYNOPSIS πŸŽ€

#include <getdata.h>

off_t gd_frameoffset(DIRFILE *dirfile, int fragment_index);

πŸ’… DESCRIPTION πŸ’…

So gd_frameoffset() slides into a dirfile(5) database β€” that's the one you point at with dirfile β€” and hands you back the frame offset (the details live in dirfile-format(5), go look, iykyk) for the fragment indexed by fragment_index. 🫢

And what even is a frame offset, you ask? It's the frame number of the very first sample of data stored in the binary files that belong to RAW fields defined in that specified fragment. Basically: your data's origin story. ⭐

Heads up: if a fragment has no RAW fields in it at all, its frame offset is just... ignored. Not relevant, not the main character, moving on. πŸ’€

Also, the dirfile argument has got to point to a valid DIRFILE object, and it has to be one you already made by calling gd_open(3). No homemade DIRFILEs, bestie, that's not the vibe. πŸ™ˆ


πŸ”₯ RETURN VALUE πŸ”₯

When everything goes right, gd_frameoffset() returns a non-negative integer holding the frame offset of the fragment you asked about. Slay. ✨

When things go wrong? It returns a negative-valued error code. Not -1 specifically, just negative, okay? Possible error codes are:

  • GD_E_BAD_DIRFILE β€” the dirfile you handed over was invalid. Not it. 😭
  • GD_E_BAD_INDEX β€” the fragment_index you supplied was out of range. 🚫

That error code also gets tucked away inside the DIRFILE object, so after the function returns you can go get it with gd_error(3). And if you want a descriptive error string β€” like, actual words β€” hit up gd_error_string(3). πŸ’œ


🌈 HISTORY 🌈

  • The get_frameoffset() function appeared in GetData-0.5.0. Baby's first debut. πŸ‘‘
  • In GetData-0.7.0, this function got renamed to gd_frameoffset(). Glow-up era. πŸ’…
  • In GetData-0.10.0, the error return from this function changed from -1 to a negative-valued error code. Periodt. πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘


And that's the whole page, bestie! This one's from Version 0.10.0, dated 25 December 2016 β€” a lil Christmas gift of a manpage. 🎁 Go forth and find your frames. πŸ§šπŸ’–