/* * * Copyright 2023 Oleg Borodin * */ #include #include #include #include int main(int argc, char** argv) { (void)argc; (void)argv; tconfig_t tconfig; tconfig_init(&tconfig); int intkey = 0; char* strkey = NULL; tconfig_bind(&tconfig, TCONF_INT, "intkey", &intkey); tconfig_bind(&tconfig, TCONF_STR, "strkey", &strkey); ssize_t rsize = tconfig_read(&tconfig, "test.conf"); printf("config size is %ld bites\n", rsize); MASSERT(rsize > 0); int res = tconfig_parse(&tconfig); if (res < 0) { char* errstr = tconfig_geterr(&tconfig); printf("parse error: %s\n", errstr); } MASSERT(res == 0); tconfig_destroy(&tconfig); printf("int key = %d\n", intkey); printf("str key = %s\n", strkey); return 0; }