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
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms