We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
我建议您使用 C++ 的 boost::property_tree 库。它有安静的详细手册。此外,我建议您使用“info”配置文件。
配置文件示例:
从配置文件检索此参数的代码示例:
I will advice you to use boost::property_tree library for C++. It has quiet detailed manual. Further I'll advice you to use "info" config file.
Example of config file:
Example of code to retrieve this parameters from config file:
对于纯 C 语言, libconfuse 相当不错
For plain C, libconfuse is quite good
几周前,我自己为“info”样式配置文件编写了一个配置解析器。它完全符合 XDG,部分可以嵌套,并且非常易于使用:
您还可以设置/锁定配置变量(包括注释)并将配置写回磁盘。它非常不言自明,但缺乏文档。请参阅
config.*
此处。我很乐意根据需要添加文档和/或界面。
I have written a config parser for "info" style config files myself a few weeks ago. It's fully XDG compliant, sections can be nested and it's pretty easy to use:
You can also set/lock config variables including comments and write the config back to disk. It's pretty self-explaining, but it lacks documentation. See
config.*
here.I'd be happy to add documentation and/or interface as needed.
看看 Augeas,它非常通用。
Take a look at Augeas, its pretty universal.