al_set_config_value(3alleg5)

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

πŸ’– al_set_config_value πŸ’–

okay bestie, welcome to another episode of "Allegro 5 API deep dives" from your fave manual, the Allegro reference manual ✨ pull up a chair, grab a strawberry πŸ“, and let's set some config values fr fr.


✨ NAME ✨

al_set_config_value β€” the Allegro 5 API function that literally puts a value into a config section. no cap. πŸ‘‘


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro5/allegro.h>

void al_set_config_value(ALLEGRO_CONFIG *config,
   const char *section, const char *key, const char *value)

that's the whole vibe. four arguments, one job, she serves. πŸ’…


🌸 DESCRIPTION 🌸

okay so here's the tea: al_set_config_value sets a value inside a section of a configuration. that's it, that's the function, and honestly? iconic.

the way that it works is:

  • if the section doesn't exist yet, it will be created. boom, new section, born just for you πŸŽ€
  • if a value already existed for the given key, it will be overwritten πŸ’€ sorry to that old value, she's gone, no funeral
  • the section can be NULL or "" for the global section. so if you don't feel like naming a section, that's valid, main character energy 🌈
⚠️ also super important, don't skip this part bestie:

for consistency with the on-disk format of config files, any leading and trailing whitespace will be stripped from the value. yeah. gone. deleted. not invited to the party.

so if you have significant whitespace you wish to preserve 😭, you should add your own quote characters and remove them when reading the values back in. that's the workaround, that's the move, iykyk. 🧚


πŸ‘‘ SEE ALSO πŸ‘‘

  • al_get_config_value(3alleg5) β€” the read-it-back counterpart, because what's the point of setting if you're not gonna get, periodt πŸ’œ

and that's the page!! tysm for reading, you ate that 🫢 stay slay, keep your configs cute, and remember: this was al_set_config_value(3alleg5) from the Allegro reference manual, Allegro 5 era, brought to you by the very same manual footer that signs off every page. mwah πŸ’‹βœ¨πŸŒΈ

πŸ“¦ where this page comes from