您可以使用下面的示例来使用libconfig:
int main() { config_t cfg; config_setting_t *setting; const char *str;
config_init(&cfg);
/* Read the file. If there is an error, report it and exit. */
if(! config_read_file(&cfg, "example.cfg"))
{
fprintf(stderr, "%s:%d - %s\n