2026-05-09 21:00:17 +08:00
2026-05-09 21:00:17 +08:00
2026-05-09 21:00:17 +08:00
2026-05-09 21:00:17 +08:00
2026-05-09 21:00:17 +08:00
2026-05-09 21:00:17 +08:00
2026-05-09 21:00:17 +08:00
2026-05-09 21:00:17 +08:00

libini

非常小的读取、写入 INI 配置文件 C 库。

支持:

  • 读取、写入字符串
  • 读取整型、长整型、浮点型
  • //、#、; 注释行
  • 行尾注释
  • key = value 等号两侧空格
  • 单引号、双引号包裹的值
  • 写入时自动创建不存在的 Section 或 Key

build

git clone https://git.aixiao.me/aixiao/libini
cd libini
make

test

make check

example

#include "libini.h"
#include <stdio.h>

int main(void)
{
    char buf[LIBINI_MAX_BUF];

    if (getinikeystring("CAT", "name", "config.ini", buf, sizeof(buf)) == 0) {
        printf("name: %s\n", buf);
    }

    printf("age: %d\n", getinikeyint("CAT", "age", "config.ini"));

    putinikeystring("CAT", "color", "Blue", "config.ini");
    return 0;
}
S
Description
No description provided
Readme
34 KiB
Languages
C 95.8%
Makefile 4.2%