SDL_SeekIO(3)

πŸ’« SDL_SeekIO β€” the glow-up guide πŸ’«

okay bestie, this one lives in the SDL3 FUNCTIONS corner of the SDL_SeekIO(3) manual, and it's literally just "teleport around inside a data stream." no cap.


✨ NAME ✨

SDL_SeekIO β€” seek within an SDL_IOStream data stream. yes girl, we're moving the cursor. slay.


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_iostream.h>

Sint64 SDL_SeekIO(SDL_IOStream *context, Sint64 offset, SDL_IOWhence whence);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole vibe is: this function seeks to byte offset, relative to whence. that's it, that's the function. it's giving "jump to wherever I point." πŸ’…

whence can be any of these iconic little values:

  • SDL_IO_SEEK_SET β€” seek from the beginning of data
  • SDL_IO_SEEK_CUR β€” seek relative to current read point
  • SDL_IO_SEEK_END β€” seek relative to the end of data
⚠️ and listen β€” if this stream can not seek, it will return -1. no drama, just facts. not every stream can do this move and that's okay.

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • context β€” a pointer to an SDL_IOStream structure. that's your stream, your main character. 🫢
  • offset β€” an offset in bytes, relative to whence location; can be negative. yes, negative. we go backwards sometimes, it's a whole thing. πŸ™ˆ
  • whence β€” any of SDL_IO_SEEK_SET, SDL_IO_SEEK_CUR, SDL_IO_SEEK_END. pick your starting point, queen. πŸ‘‘

⭐ RETURN VALUE ⭐

returns the final offset in the data stream after the seek, or -1 on failure. and if it fails? call SDL_GetError() for more information β€” that's your gossip source, fr fr. 😭


πŸ”₯ THREAD SAFETY πŸ”₯

do not use the same SDL_IOStream from two threads at once. that's a red flag, bestie. one stream, one thread, periodt. πŸ’€

🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0. so if you're on something older… no it isn't. 😌


πŸ’– SEE ALSO πŸ’–

  • SDL_TellIO(3) β€” the "where am I rn" counterpart. they're a duo, iykyk.

and that's the whole page, mwah. this was the SDL_SeekIO(3) page from Simple Directmedia Layer, SDL 3.4.18 era β€” go forth and seek responsibly, angel πŸ§šπŸ’œ

πŸ“¦ where this page comes from