1override_config_file(3) Allegro manual override_config_file(3)
2
3
4
6 override_config_file - Specifies a file containing config overrides.
7 Allegro game programming library.
8
10 #include <allegro.h>
11
12
13 void override_config_file(const char *filename);
14
16 Specifies a file containing config overrides. These settings will be
17 used in addition to the parameters in the main config file, and where a
18 variable is present in both files this version will take priority. This
19 can be used by application programmers to override some of the config
20 settings from their code, while still leaving the main config file free
21 for the end user to customise. For example, you could specify a partic‐
22 ular sample frequency and IBK instrument file, but the user could still
23 use an `allegro.cfg' file to specify the port settings and irq numbers.
24
25 The override config file will not only take precedence when reading,
26 but will also be used for storing values. When you are done with using
27 the override config file, you can call override_config_file with a NULL
28 parameter, so config data will be directly read from the current config
29 file again.
30
31 Note: The override file is completely independent from the current con‐
32 figuration. You can e.g. call set_config_file, and the override file
33 will still be active. Also the flush_config_file function will only
34 affect the current config file (which can be changed with set_con‐
35 fig_file), never the overriding one specified with this function. The
36 modified override config is written back to disk whenever you call
37 override_config_file.
38
39 Example:
40
41 override_config_file("my.cfg");
42 /* This will read from my.cfg, and if it doesn't find a
43 * setting, will read from the current config file instead.
44 */
45 language = get_config_string("system", "language", NULL);
46 /* This will always write to my.cfg, no matter if the
47 * settings is already present or not.
48 */
49 set_config_string("system", "language", "RU");
50 /* This forces the changed setting to be written back to
51 * disk. Else it is written back at the next call to
52 * override_config_file, or when Allegro shuts down.
53 */
54 override_config_file(NULL);
55
56 Note that this function and override_config_data() are mutually exclu‐
57 sive, i.e. calling one will cancel the effects of the other.
58
59
61 override_config_data(3), set_config_file(3)
62
63
64
65Allegro version 4.4.3 override_config_file(3)