set_config_string(3alleg4)
π set_config_string π
okay bestie, so this is a page from the Allegro manual β the Allegro game programming library, if you didn't already know, and we're talking about set_config_string, which is literally the girl who writes your strings into the config file. main character energy fr fr. β¨
πΈ SYNOPSIS πΈ
#include <allegro.h>
void set_config_string(const char *section, const char *name, const char *val);
like, that's the whole signature. she takes a section, a name, and a val and she does her thing. periodt. π
π¦ DESCRIPTION π¦
So here's the tea: set_config_string writes a string variable to the current config file, replacing any existing value it may have. Just fully evicting the old value, no apology, iconic behaviour honestly. π
And if val is NULL? Not me deleting the variable entirely π β yep, passing NULL as val removes the variable. gone. bye. π
The section name is giving options:
- Set it to
NULLand the variable goes to the root of the file, no section, just vibes. - Or use it to control which section the variable is inserted into. very much your choice bestie. β¨
β οΈ okay so listen β the altered file gets cached in memory and is NOT actually written to disk until you call allegro_exit(). she's holding it in her head until you tell her to commit, lowkey relatable. π«Ά
Also, important: you can only write to files this way. So if the current config source was specified with set_config_data() rather than set_config_file(), this function will have no effect. literally nothing. zero. π not her fault, that's just how it is.
β¨ the special case (iykyk) β¨
As a special case, variable or section names that begin with a # character are treated specially and will not be read from or written to the disk. So sneaky, so chic. π
Addon packages can use this to store version info or other status information into the config module, from where it can be read with the get_config_string() function. cute little secret pocket, love that for them. π
π SEE ALSO π
set_config_file(3alleg4)get_config_string(3alleg4)set_config_float(3alleg4)set_config_hex(3alleg4)set_config_int(3alleg4)set_config_id(3alleg4)
go read those too bestie, they're all in the same friend group fr fr. π
and that's the whole page!! written by Allegro, version 4.4.3, and dated right along with set_config_string(3alleg4) β mwah, slay, go write some strings. π
β¨π
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms