SDL_SaveFile_IO(3)

✨ SDL_SaveFile_IO ✨

okay bestie, welcome to the SDL_SaveFile_IO(3) page, straight out of the SDL3 FUNCTIONS section of the manual. this one is short, it's sweet, and it literally just yeets all your data into an SDL data stream. no cap. πŸ’…


🌸 NAME 🌸

SDL_SaveFile_IO β€” save all the data into an SDL data stream. that's it, that's the job, and she does it flawlessly. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_iostream.h>

bool SDL_SaveFile_IO(SDL_IOStream *src, const void *data, size_t datasize, bool closeio);

one function, four arguments, zero drama. ✨


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • src β€” the SDL_IOStream you want to write all the data to. she's the destination, the main character, the place where things get written. πŸ‘‘
  • data β€” the actual data getting written. here's the tea though: if datasize is 0, this may be NULL or an invalid pointer. literally the only time an invalid pointer is allowed to vibe here. 😭
  • datasize β€” the number of bytes to be written. count 'em, bestie. πŸ”’
  • closeio β€” if true, it calls SDL_CloseIO() on src before returning β€” even in the case of an error. so like, it closes the door behind you no matter how the night went. πŸšͺπŸ’€

πŸ’œ RETURN VALUE πŸ’œ

returns true on success or false on failure. if it flops, call SDL_GetError() for more information β€” she'll tell you exactly what went wrong, fr fr. 🫢


πŸ”₯ THREAD SAFETY πŸ”₯

do not use the same SDL_IOStream from two threads at once. that's it. that's the whole rule. sharing is not caring in this specific case, bestie. 🚫🧡

⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0. so if you're on something older, sorry babe, no function for you. πŸ™ˆ


🌈 SEE ALSO 🌈


and that's the whole page, you ate it up. πŸ’… this gem comes to you courtesy of Simple Directmedia Layer, rockin' SDL 3.4.18 β€” go forth and save your files, icon. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from