SDL_SetEnvironmentVariable(3)

πŸ’– SDL_SetEnvironmentVariable πŸ’–

okay so bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_SetEnvironmentVariable β€” the girl whose whole job is putting a variable into an environment. she's giving glow-up energy for your env vars, fr fr. πŸŽ€


✨ NAME ✨

SDL_SetEnvironmentVariable β€” set the value of a variable in the environment. literally that's it, that's the gig. πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const char *value, bool overwrite);

✨ FUNCTION PARAMETERS ✨

  • env β€” the environment you wanna modify. the lil world you're editing, bestie. 🌍
  • name β€” the name of the variable you're setting. πŸ‘‘
  • value β€” the value you're giving that variable. the whole point of the operation, honestly.
  • overwrite β€” true if you want to overwrite the variable when it already exists; false if you want it to just return success without setting anything when it already exists. like, "nah she's already here, we're good" energy. πŸ™ˆ

✨ RETURN VALUE ✨

Returns true on success or false on failure. and if it's giving failure?? call SDL_GetError() for more info, she'll tell you what went wrong. 😭


✨ THREAD SAFETY ✨

It is safe to call this function from any thread. no cap, go wild, every thread is invited to the party. 🧚


✨ AVAILABILITY ✨

This function is available since SDL 3.2.0. vintage-ish but still iconic. ⭐


✨ SEE ALSO ✨

the whole friend group, obviously:


Simple Directmedia Layer πŸ¦‹ this was SDL 3.4.18, dated with all the love, and the page you just read is SDL_SetEnvironmentVariable(3). mwah, go set some variables bestie, you're gonna ate πŸ’…βœ¨πŸ«Ά

πŸ“¦ where this page comes from