【发布时间】:2014-04-19 21:02:40
【问题描述】:
我对使用 c++ 的 boost 库比较陌生,我想知道如何使用它打开文件。我的目标是从 json 文件中读取,但我不知道如何打开该文件。
在 c++ 中,你可以这样做
int main () {
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
但是如何使用 boost 来做到这一点?
【问题讨论】:
-
也许 SO 项目 Serializing and deserializing json with boost 会有所帮助。
-
在这里使用 boost 不会增加太多。
-
Boost 只是一个库。它添加了标准库没有的东西。这不是这样的例子。