I'm trying to read a bool setting from a group. I'm using the following code, but config_lookup_bool
always returns CONFIG_FALSE. As far as I understood it should write the value into send_keys
and return CONFIG_TRUE instead.
Code:
int send_keys;
config_t cfg;
config_init(&cfg);
config_read_file(&cfg, "config.cfg")
if (config_lookup_bool(&cfg, "settings.send_keys", &send_keys))
{
// do something here
}
config.cfg:
settings :
{
send_keys = "true";
start_apps = "false";
sync_clocks = "false";
pc_clock_is_origin = "true";
calibration_start_time = 0L;
};
Is there any mistake in my code or my thoughts?
int config_lookup_bool (const config_t * config, const char * path, int * value)
The 2nd argument denotes a path. Is"settings.send_keys"
a path? Are you sure about that argument? maybe use.\\"config.cfg"
or if Linux./"config.cfg"
– ryykersettings.send_keys
to be a path. I took it from example1.c and the corresponding example.cfg. Myconfig.cfg
itself can be read. There are some more settings which I read at another place without problems. – pikim