I am using libconfig to read/wirte config files in my C++ game.
Right now I just have this one config file called video.cfg:
#Video config file
video:
{
fps:
{
limited = true;
value = 20;
};
};
This config file handles the video settings of the game.
I am trying to write a very basic console program that modifies this values based on user input. However I have no idea how to do this. I can’t find anything in libconfig manual and nothing on Google.
So how do you edit values in Libconfig?
I named the file “lcex.c” and the config file “myconfig” It builds and runs on my Debian Linux machine using the following…
Open your config file after running the app and you should see that the values have been updated.
Disclaimer…error handling left out to make it easier to read. I didn’t build with -Wall, etc. As with any API, read the docs and handle potential errors.