📜  如何使用 rapidjson 读取和解析 json 文件 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:45.473000             🧑  作者: Mango

代码示例1
FILE *fp = fopen("input.json", "r"); // stupid windows need rb
    char buf[0XFFFF];
 
    //FileReadStream(FILE *fp, char *buffer, std::size_t bufferSize)
    rapidjson::FileReadStream input(fp, buf, sizeof(buf));
    rapidjson::Document document;
    document.ParseStream(input);
    fclose(fp);

    cout << document["hello"].GetString() << endl;