inih C++

这是一个只有头文件的 C++ 版本的inih。「This is a header only C++ version of inih.」

  • 所有者: jtilly/inih
  • 平台: Linux,Windows,Mac
  • 許可證: Other
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

inih

Build Status

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

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 be small and simple, so it's good for embedded systems. It's also more or less compatible with Python's ConfigParser style of .INI files, including RFC 822-style multi-line syntax and name: value entries.

Usage

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

#include <iostream>
#include "INIReader.h"

int main() {

    INIReader reader("test.ini");

    if (reader.ParseError() != 0) {
        std::cout << "Can't load 'test.ini'\n";
        return 1;
    }
    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";
    return 0;

}

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

主要指標

概覽
名稱與所有者jtilly/inih
主編程語言C++
編程語言C++ (語言數: 1)
平台
許可證Other
所有者活动
創建於2016-01-18 19:16:20
推送於2024-09-18 13:41:38
最后一次提交2024-09-18 15:40:34
發布數0
用户参与
星數444
關注者數19
派生數95
提交數93
已啟用問題?
問題數9
打開的問題數0
拉請求數12
打開的拉請求數0
關閉的拉請求數3
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?