SDL_FlushIO(3)

πŸ’– SDL_FlushIO(3) β€” the SDL3 functions glow-up πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual, where we're talking about SDL_FlushIO β€” aka the "pls just send it already" function 🫢


✨ NAME ✨

SDL_FlushIO β€” flush any buffered data in the stream. no cap, that's the whole job description πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_iostream.h>

bool SDL_FlushIO(SDL_IOStream *context);

✨ DESCRIPTION ✨

so here's the tea β˜• β€” this function makes sure that any buffered data is written to the stream. it's giving "bestie, hit send" energy πŸ“¨

normally this isn't necessary πŸ₯± β€” like, the stream handles its own business most of the time and you can just vibe. but if the stream is a pipe or a socket, this guarantees that any pending data is actually sent. that's the moment where SDL_FlushIO is literally the main character πŸ‘‘


✨ FUNCTION PARAMETERS ✨

  • context β€” the SDL_IOStream structure you wanna flush. yes, that one. the stream. give it a lil flush 🌊

✨ RETURN VALUE ✨

  • returns true on success πŸŽ‰
  • returns false on failure 😭 β€” and if that happens, call SDL_GetError() for more info, she'll tell you what went wrong πŸ’€

✨ THREAD SAFETY ✨

🚨 do not use the same SDL_IOStream from two threads at once. i'm so serious. that's a vibe check you do NOT want to fail πŸ™ˆ

✨ AVAILABILITY ✨

this function has been available since SDL 3.2.0 ⭐ so if you're on anything older, that's a you problem (respectfully) πŸ’œ


✨ SEE ALSO ✨

go read those too, they're iconic in their own right πŸ¦‹


and that's the whole page, bestie!! brought to you by Simple Directmedia Layer 🌈, running the SDL 3.4.18 era of the SDL 3 timeline ✨ β€” flush responsibly, mwah πŸ’‹πŸŽ€

πŸ“¦ where this page comes from