hyperrealm / libconfig

C/C++ library for processing configuration files
https://hyperrealm.github.io/libconfig/
GNU Lesser General Public License v2.1
1.11k stars 362 forks source link

config_lookup_bool doesn't work #188

Closed pikim closed 3 years ago

pikim commented 3 years ago

I'm trying to read a bool setting from a group. I'm using this 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. Is there any mistake in my code or my thought?

Code:

config_t cfg;
int send_keys;

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;
};