I was wondering if there was a simpler way to use key=value pairs in C programming. I have a parser for an ini file that will create the pairs. I also need default values at run time
// initialize defaults
struct SettingsKeys SettingsKey = {
"key_3",
"key_2",
"key_1",
};
struct SettingsValues SettingsValue = {
0,
56,
"my_value"
};
// main code to use:
// - parse ini file to see if we have to modify the default values
// - run with retained values
// if (SettingsKey.value_1 == x)...
This works perfectly but a bit complicated to maintain 4 declarations in both files...
Is there an easier way to declare AND initialize defaults for the pairs?
The other thing that complicates it is that values are of different types