SDL_WriteU16LE(3)

πŸ’– SDL_WriteU16LE πŸ’–

okay bestie, welcome to the SDL_WriteU16LE(3) page β€” it lives in the SDL3 FUNCTIONS section of the manual and it's literally your little endian bestie for 16-bit writes ✨


✨ NAME ✨

SDL_WriteU16LE β€” use this function to write 16 bits in native format to an SDL_IOStream as little-endian data πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_iostream.h>

bool SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the vibe is this: SDL byteswaps the data only if it's necessary. that means you β€” yes you, the application β€” always specify native format, and the data that actually gets written lands in little-endian format. no cap. πŸ’…


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • dst β€” the stream to which data will be written. (your destination stream, the place the bytes are going 🫢)
  • value β€” the data to be written, in native format. (native, bestie, not little-endian β€” SDL handles the rest 😌)

⭐ RETURN VALUE ⭐

returns true on a successful write, or false on failure 😭 β€” and if it fails, call SDL_GetError() for more information. that's your group chat for what went wrong.


πŸ”₯ THREAD SAFETY πŸ”₯

do not use the same SDL_IOStream from two threads at once. i'm so serious. that's giving chaos and we don't want that energy πŸ’€


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0 πŸ‘‘


lowkey reminder: native format goes in, little-endian comes out, and the byteswapping only happens when it has to. periodt. πŸ’œ

mwah that's the whole page, you ate it, go write some bytes 🧚 β€” this came to you from Simple Directmedia Layer, SDL version 3.4.18, dated SDL_WriteU16LE(3). ily, see you in the next manpage πŸ’–βœ¨

πŸ“¦ where this page comes from