SDL_GetStringProperty(3)

✨ SDL_GetStringProperty(3) ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the manual πŸ’– this one is called SDL_GetStringProperty, and it's literally just "hey, what's that string property set to?" but make it a whole manpage. no cap.


🌸 NAME 🌸

SDL_GetStringProperty β€” get a string property from a group of properties. that's it, that's the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <SDL3/SDL_properties.h>

const char * SDL_GetStringProperty(SDL_PropertiesID props, const char *name, const char *default_value);

look at her. three args, returns a const char *, does exactly one job and does it slay πŸ’…


πŸ’œ FUNCTION PARAMETERS πŸ’œ

  • props β€” the properties you wanna query, aka the lil group you're digging through 🫢
  • name β€” the name of the property you're asking about. yes, by name. iconic behavior.
  • default_value β€” the fallback value for the property. your safety net, your emotional support string 😭

πŸŽ€ RETURN VALUE πŸŽ€

Returns the value of the property β€” ate β€” OR it returns default_value if it's not set, or if it's set but it's not a string property. so like, if it's not giving string, you get the default. periodt πŸ’€


πŸ”₯ THREAD SAFETY πŸ”₯

okay so this is the part where we get real for a sec:

It's safe to call this function from any thread βœ…. BUT (and this is a big but) the data returned is not protected, and it could potentially be freed if you call SDL_SetStringProperty() or SDL_ClearProperty() on these properties from another thread. 😭 the audacity.

If you need to avoid that whole situation, use SDL_LockProperties() and SDL_UnlockProperties(). lock in, bestie πŸ”’βœ¨

🌈 AVAILABILITY 🌈

This function has been available since SDL 3.2.0. so if you're on something older... girl, upgrade πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

go read those too, they're all in the same friend group 🫢


and that's the page!! brought to you by Simple Directmedia Layer, running the SDL 3.4.18 era, mwah πŸ’‹ bye bestie, go read a property πŸ¦‹βœ¨

πŸ“¦ where this page comes from