Skip to content

neo3587/ini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INI

A simple INI file parser for C++

Notes

You need to download the oi_map library from the sumbodule folder

Usage Example

#include "ini.hpp"
#include <iostream>
#include <string>



int main(int argc, char* argv[]) {

  neo::ini<> ini; // neo::ini<> == sections and keys, neo::ini<false> == only keys
  ini.parse_file("test.ini"); // istreams are also allowed
  
  // ini works like a map of maps that keeps the insertion order, 
  // you can use arithmetic types (short, int, float, double, ...)
  // and strings to write/read the values of each key
  int val = ini["section 0"]["key 0"];
  std::string str = ini["section 0]["key 1"];
  ini["section 0"]["key 3"] = 123.45;
  ini["section 0"]["key 4"] = "StringValue";
    
  std::cout << ini.to_string() << std::endl;
  
  ini.to_file("test_out.ini"); // ostreams are also allowed

  return 0;
}

About

A simple INI file parser for C++

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages