SDL_GetEnvironmentVariable(3)

πŸ’– SDL_GetEnvironmentVariable(3) πŸ’–

okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_GetEnvironmentVariable β€” she gets the value of a variable in the environment. that's it, that's the gig, and she does it flawlessly. periodt. ✨


🌸 NAME 🌸

SDL_GetEnvironmentVariable β€” get the value of a variable in the environment. like, you hand her a name, she hands you back the value. iconic behaviour, no notes. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_stdinc.h>

const char * SDL_GetEnvironmentVariable(SDL_Environment *env, const char *name);

look at her. one function, two args, returns a const char *. she's not complicated, she's just that girl. πŸ’…


πŸ¦‹ FUNCTION PARAMETERS πŸ¦‹

  • env β€” the environment to query. yes, the whole environment. she's asking this specific one, so don't go handing her a random one and expecting magic, bestie. πŸ™ˆ
  • name β€” the name of the variable to get. the lil lookup key. the name tag at the party. you give her the name, she finds the variable. πŸ”₯

🌈 RETURN VALUE 🌈

she returns a pointer to the value of the variable... or NULL if it can't be found. and that's the whole vibe check: found = pointer, not found = NULL. no cap, that's literally it. if you get a NULL back, don't be dramatic, the variable just isn't there. 😭


🧚 THREAD SAFETY 🧚

it is safe to call this function from any thread. any of them. all of them. go wild, thread girlies, she's built for it. ⭐


πŸ‘‘ AVAILABILITY πŸ‘‘

this function has been available since SDL 3.2.0. so if you're on something older... babes, upgrade. πŸŽ€


πŸ’œ SEE ALSO πŸ’œ

the whole environment friend group honestly β€” get one, create one, get all of them, set one, unset one. collect the set, slay. ✨


and that's the page, bestie!! πŸ’– brought to you by Simple Directmedia Layer, SDL 3.4.18, and this very SDL_GetEnvironmentVariable(3) page β€” mwah, go read your environment, ily, bye!! πŸ¦‹πŸŒΈπŸ“

πŸ“¦ where this page comes from