Search code examples
c++configuration-filesembedded-resource

Method to store a configuration file inside executable in C++


I need to store a configuration file that can be changed once the executable has been compiled inside of an executable using C++. I assume the configuration file would need to be stored as a resource for it to be editable once the executable has been compiled.

I have no idea how I can go about storing it as a resource and how to then include it in the main section of my project while still leaving it in the resource section.

Any help will be much appreciated.


Solution

  • Windows "*.ini" files is one way.

    But, I suggest use XML files for configuration. Most compilers have 2 or 3 libraries to load & store data from XML files.

    Besides, they allow to store information in a hierarchical way, and easy to add or remove configuration options.

    EDIT: Another way are JSON files.