1 bool ret = false;
2
3 //Json::FastWriter writer_ob;
4 //std::string jsonStr = writer_ob.write(root);
5
6 std::string jsonStr = root.toStyledString();
7
8 std::ofstream fob(filepath, std::ios::trunc | std::ios::out);
9
10 if (false != fob.is_open())
11 {
12 fob.write(jsonStr.c_str(), jsonStr.length());
13 fob.close();
14 ret = true;
15 std::string ferror = "写入配置文件成功:" + filepath;
16 PDmsg(ferror);
17 }
18 else
19 {
20 std::string ferror = "写入配置文件 打开 错误:" + filepath;
21 PEmsg(ferror);
22 }
23
24 return ret;