gpt4 book ai didi

c - 在 Linux 上使用 C 中的 INI 文件

转载 作者:IT王子 更新时间:2023-10-29 00:17:21 26 4
gpt4 key购买 nike

是否有一种标准的方式来读取像 INI 这样的配置?使用 C 的 Linux 文件?

我正在开发基于 Linux 的手持设备并使用 C 语言编写代码。

否则,我想知道任何替代方案。

最后更新:

我探索过甚至使用过 LibConfig。但是占用空间大,我的用法太简单了。因此,为了减少足迹,我推出了自己的实现。实现不是太通用,实际上到目前为止已经很耦合了。配置文件在启动应用时解析一次,并设置一些全局变量。

最佳答案

试试 libconfig :

a simple library for processing structured configuration files, like this one: test.cfg. This file format is more compact and more readable than XML. And unlike XML, it is type-aware, so it is not necessary to do string parsing in application code.

Libconfig is very compact — a fraction of the size of the expat XML parser library. This makes it well-suited for memory-constrained systems like handheld devices.

The library includes bindings for both the C and C++ languages. It works on POSIX-compliant UNIX and UNIX-like systems (GNU/Linux, Mac OS X, Solaris, FreeBSD), Android, and Windows (2000, XP and later)...

关于c - 在 Linux 上使用 C 中的 INI 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2280352/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com