小编Yel*_*ats的帖子

JSONCPP写入文件

JSONCPP有一个编写器,但它似乎只是从解析器获取信息,然后将其输出到字符串或流中.如何更改或创建新对象,数组,值,字符串等并将其写入文件?

c++ json jsoncpp

23
推荐指数
4
解决办法
5万
查看次数

JSONCPP无法正确读取文件

所以我最近安装了JSONCPP,出于某种原因,当我尝试这段代码时它给了我错误:

#include <json.h>
#include <iostream>
#include <fstream>

int main(){
    bool alive = true;
    while (alive){
    Json::Value root;   // will contains the root value after parsing.
    Json::Reader reader;
    std::string test = "testis.json";
    bool parsingSuccessful = reader.parse( test, root, false );
    if ( !parsingSuccessful )
    {
        // report to the user the failure and their locations in the document.
        std::cout  << reader.getFormatedErrorMessages()
               << "\n";
    }

    std::string encoding = root.get("encoding", "UTF-8" ).asString();
    std::cout << encoding << "\n";
    alive = false;


    }
    return 0; …
Run Code Online (Sandbox Code Playgroud)

c++ json

12
推荐指数
1
解决办法
2万
查看次数

使用Visual Studio 2010构建JSONCPP

我该如何构建它?文档真的很阴暗.它说你需要将scons.py放在目录中,但我不知道它在哪里.我尝试使用包含的prebuild,但它没有生成任何.lib文件.

c++ visual-studio-2010 jsoncpp

6
推荐指数
2
解决办法
8705
查看次数

标签 统计

c++ ×3

json ×2

jsoncpp ×2

visual-studio-2010 ×1