SDL_ReadU32BE(3)

πŸ’– SDL_ReadU32BE πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, where we're talking about SDL_ReadU32BE(3) β€” the girlies' favourite way to slurp 32 bits of big-endian data out of an SDL_IOStream and hand it back to you in native format. ✨


🌸 NAME 🌸

SDL_ReadU32BE β€” use this function to read 32 bits of big-endian data from an SDL_IOStream and return in native format. no cap, that's literally the whole job. 🫢


✨ SYNOPSIS ✨

#include <SDL3/SDL_iostream.h>

bool SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value);

πŸ¦‹ DESCRIPTION πŸ¦‹

SDL byteswaps the data only if necessary, so the data returned will be in the native byte order. so like, it's not doing extra work for no reason β€” it's giving considerate. πŸ’…

This function will return false when the data stream is completely read, and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. If false is returned and the stream is not at EOF, SDL_GetIOStatus() will return a different error value and SDL_GetError() will offer a human-readable message. so like, false can mean two very different things and you gotta check which one it is. πŸ™ˆ

⚠️ lowkey important: false on its own does not tell you "the stream ended". it might be EOF, it might be a real error. the status function is the one who knows. πŸ‘‘

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • src β€” the stream from which to read data. 🌊
  • value β€” a pointer filled in with the data read. πŸ“

🌈 RETURN VALUE 🌈

Returns true on successful read or false on failure; call SDL_GetError() for more information. that's it, that's the whole vibe check. βœ…


πŸ’œ THREAD SAFETY πŸ’œ

Do not use the same SDL_IOStream from two threads at once. fr fr, do not do it. one stream, one thread, that's the rule. βœ‹


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. πŸŽ‰


and that's the tea, bestie! πŸ’– this page came to you courtesy of Simple Directmedia Layer, sitting pretty at SDL 3.4.18, dated SDL_ReadU32BE(3) β€” so go forth, read those bytes, and stay slay. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from