al_get_config_value(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_get_config_value πŸ’–

okay so bestie, welcome to the Allegro 5 API reference manual, and today's main character is al_get_config_value ✨ she's a little getter function and she's serving borrowed memory realness, so listen up 🫢


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

const char *al_get_config_value(const ALLEGRO_CONFIG *config,
   const char *section, const char *key)

like, that's the whole vibe. she takes a config, a section and a key, and she gives you back a const char *. no cap πŸ’…


✨ DESCRIPTION ✨

okay so here's the tea πŸ“ β€” this function gets you a pointer to an internal character buffer. and the way that pointer stays valid is only for as long as the ALLEGRO_CONFIG structure hasn't been destroyed. that's it. that's the whole lifetime. once the config goes bye-bye, that pointer is giving dangling and you do NOT want that energy 😭

so if you actually need a copy of the value? copy the value. literally. make your own. because this buffer is not yours, it's the config's, and she's just lending it to you for a sec πŸŽ€

also, quick note: the section can be NULL or β€œβ€ if you're trying to reach the global section β€” yes, both work, she's flexible like that πŸ’œ

and if the section or the key just straight up don't exist? you get NULL back. no drama, no error, just NULL πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the page, bestie!! this was the Allegro reference manual, page al_get_config_value(3alleg5), and honestly? iconic. periodt πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from