c++ - 有没有一些通用的方法来写入和读取配置文件?

标签 c++ configuration configuration-files

我需要我的程序来创建和编辑一个配置文件,其中包含有关一组对象的信息,而不是在每次执行时读取它。我可以使用某种配置样式指南吗?

我在 Windows 上使用 C++。

最佳答案

我建议查看 boost::property_tree .

The Property Tree library provides a data structure that stores an arbitrarily deeply nested tree of values, indexed at each level by some key. Each node of the tree stores its own value, plus an ordered list of its subnodes and their keys. The tree allows easy access to any of its nodes by means of a path, which is a concatenation of multiple keys.

此外,它还包含用于 XML、INI 和 JSON 的解析器和生成器,因此您可以以您选择的格式保存/加载。

关于c++ - 有没有一些通用的方法来写入和读取配置文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2655157/

相关文章:

vim - 如何定位vim编辑器使用的vimrc文件?

java - 使用 java.util.properties 存储 ArrayList 和 HashMap

asp.net-core - 如何在多个部署环境中管理微服务架构中的配置文件?

c++ - Boost.Coroutine 和 Boost.Coroutine2 的区别

c++ - 给定一组点,找到与查询点曼哈顿距离最小的点

c++ - C++ 中的内存分配区域(堆栈 vs 堆 vs 静态)

java - 如何使用今天的日期传入文件名值属性

c# - MS Blend 3&4 能否打开包含混合代码的解决方案?

configuration - .NET Core 配置 - System.Net connectionManagement/maxconnections?

postgresql - Postgres : missing or erroneous pg_hba. 配置文件