Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

This is a header only C++ version of inih.

License

NotificationsYou must be signed in to change notification settings

jtilly/inih

Repository files navigation

CI

This is a header only C++ version ofinih.

inih (INI Not Invented Here) is a simple.INI file parser written in C. It's only a couple of pages of code, and it was designed to besmall and simple, so it's good for embedded systems. It's also more or less compatible with Python'sConfigParser style of .INI files, including RFC 822-style multi-line syntax andname: value entries.

Usage

All you need to do is to includeINIReader.h. Consider the following example (INIReaderTest.cpp):

#include<iostream>#include"INIReader.h"intmain() {    INIReaderreader("test.ini");if (reader.ParseError() !=0) {        std::cout <<"Can't load 'test.ini'\n";return1;    }    std::cout <<"Config loaded from 'test.ini': version="              << reader.GetInteger("protocol","version", -1) <<", name="              << reader.Get("user","name","UNKNOWN") <<", email="              << reader.Get("user","email","UNKNOWN") <<", pi="              << reader.GetReal("user","pi", -1) <<", active="              << reader.GetBoolean("user","active",true) <<"\n";return0;}

To compile and run:

g++ INIReaderTest.cpp -o INIReaderTest.out./INIReaderTest.out# Config loaded from 'test.ini': version=6, name=Bob Smith, email=bob@smith.com, pi=3.14159, active=1

About

This is a header only C++ version of inih.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp