SDL_setenv_unsafe(3)

πŸ’– SDL_setenv_unsafe πŸ’–

okay bestie, so this is a page from the SDL3 FUNCTIONS manual, and today's main character is SDL_setenv_unsafe β€” the little env-var setter that lowkey does exactly what it says but comes with a vibe warning, so stay with me 🫢


✨ NAME ✨

SDL_setenv_unsafe β€” sets the value of a variable in the environment. that's it, that's the whole job πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

int SDL_setenv_unsafe(const char *name, const char *value, int overwrite);

πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • name β€” the name of the variable you wanna set, bestie. like the label on the jar πŸŽ€
  • value β€” the value of the variable you're setting. the contents of the jar, if you will ✨
  • overwrite β€” the drama parameter πŸ‘€ pass 1 and it will overwrite the variable if it already exists; pass 0 and it just returns success without touching the variable if it's already there. so 0 is the "no thoughts, respect the existing vibe" option 🌈

πŸ‘‘ RETURN VALUE πŸ‘‘

  • returns 0 on success πŸŽ‰
  • returns -1 on error 😭

πŸ’€ THREAD SAFETY πŸ’€

not me warning you but… this function is not thread safe, periodt.

consider using SDL_SetEnvironmentVariable() instead, fr fr 🫢


⭐ AVAILABILITY ⭐

this function is available since SDL 3.2.0 ✨ iconic, honestly.


🌈 SEE ALSO 🌈


and that's the whole page, babe, you ate it πŸ’…βœ¨

signing off with love: this came from the Simple Directmedia Layer crew, SDL 3.4.18 edition β€” mwah πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from