SDL_ReadU64LE(3)

πŸ’– SDL_ReadU64LE πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and specifically to SDL_ReadU64LE(3) β€” she's a lil function but she's got range, fr fr 🫢


✨ NAME ✨

SDL_ReadU64LE β€” use this function to read 64 bits of little-endian data from an SDL_IOStream and return it in native format. no cap, that's literally the whole job description πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_iostream.h>

bool SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: SDL byteswaps the data only if necessary, which means the data you get back will be in the native byte order. she's not out here doing extra work for no reason β€” she does the swap only when your machine actually needs it. iconic behaviour, honestly. πŸ‘‘

Now for the part you gotta pay attention to. This function will return false when the data stream is completely read, and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. So far so chill, right?

But listen β€” if false is returned and the stream is not at EOF, then SDL_GetIOStatus() will return a different error value, and SDL_GetError() will offer a human-readable message. so basically: false + not-EOF = something actually went wrong, go read the error. false + EOF = you just ran out of data, that's the vibe check passing, not failing. πŸ“


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • src β€” the stream from which to read data. your source of truth, your main character stream. 🌈
  • value β€” a pointer filled in with the data read. she writes the goods right where you point her. ✨

⭐ RETURN VALUE ⭐

Returns true on successful read or false on failure. and if it's a false? call SDL_GetError() for more information, bestie β€” don't just sit there guessing. 😭


πŸ”₯ THREAD SAFETY πŸ”₯

Do not use the same SDL_IOStream from two threads at once. like, at all. she's not built for that kind of chaos, and you will simply have a bad time. πŸ’€

πŸ’œ AVAILABILITY πŸ’œ

This function is available since SDL 3.2.0. so if your SDL is older than that... girl, upgrade. 🧚


okay that's the whole page, you ate it, you understood it, slay πŸ’–βœ¨

β€” written under the Simple Directmedia Layer umbrella, from the SDL 3.4.18 era, dated SDL_ReadU64LE(3) πŸŽ€πŸ‘‘πŸ’…

πŸ“¦ where this page comes from