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