SDL_ReadU16LE(3)
π SDL_ReadU16LE π
okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, page SDL_ReadU16LE(3), and yes we are about to read 16 bits of little-endian data out of an SDL_IOStream and hand it back to you in native format. slay.
β¨ NAME β¨
SDL_ReadU16LE β use this function to read 16 bits of little-endian data from an SDL_IOStream and return in native format. it's giving "endianness? handled." π¦
β¨ SYNOPSIS β¨
#include <SDL3/SDL_iostream.h>
bool SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value);
β¨ DESCRIPTION β¨
so here's the tea: SDL byteswaps the data only if necessary, so the data you get back will be in the native byte order. no cap, it just does the right thing for your machine. π
this function will return false when the data stream is completely read, and SDL_GetIOStatus() will return SDL_IO_STATUS_EOF. and if false is returned but 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β¦ read the status, bestie, don't assume. π
β¨ FUNCTION PARAMETERS β¨
srcβ the stream from which to read data. your source, your main character. πvalueβ a pointer filled in with the data read. this is where the 16 bits land. β¨
β¨ RETURN VALUE β¨
returns true on successful read or false on failure; call SDL_GetError() for more information. simple as that. π
β¨ THREAD SAFETY β¨
do not use the same SDL_IOStream from two threads at once. seriously. that's a whole mess you do not want. π
β¨ AVAILABILITY β¨
this function is available since SDL 3.2.0. so if you're on something older, it's giving "not yet, babe." πΈ
and that's the whole vibe check, fr fr. this page came to you from Simple Directmedia Layer, rocking SDL 3.4.18 β thanks for reading, ily, go read your streams responsibly π«Άβ¨π
π¦ 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