Skip to content

DRHandyman/LibCfgPP

Repository files navigation

LibCfg++ C/C++ CI

LibCfg++ is a convenient C++ library for working with configuration files.

What can it do?

  • Manipulate strings (Read and change string values).
  • Create and read sections.
  • Format the file in its own style.
  • Scan the file for errors.

Dependencies

Linux:

  • G++ (GCC >= 4.8.1) - sudo apt-get install g++

Windows:

Usage

  • Clone this repository to any folder you like, using this command git clone https://github.com/DRHandyman/LibCfgPP. If you do not have GIT installed, then here is a link to the documentation for installing it.
  • Drag and drop files LibCfgPP.cpp and LibCfgPP.hpp to the folder with your project.
  • Compile the source file LibCfgPP.cpp along with the rest of the source files.

Demonstration

Demonstration

Code example

// main.cpp #include <iostream> #include "LibCfgPP.hpp" using namespace std; LibCfgPP::CfgFile cfg_file; int main() { try { cfg_file.open("cfg_file.cfg"); cout << cfg_file.read("string") << endl << cfg_file.read("section", "string") << endl; } catch (const LibCfgPP::LCPPException &ex) { cout << ex.what() << endl; } cfg_file.close(); return EXIT_SUCCESS; }
# cfg_file.cfg string = "value" # Test comment [section] string = "value" # Test comment 
  • You can run the sample code on the Replit website.
  • Added the ability to read string values and read sections.
  • Added the ability to change the string value.

Notes

Packages

No packages published

Contributors 2

  •  
  •  

Languages