JSONCPP Writing to files

后端 未结 5 1897
我在风中等你
我在风中等你 2020-12-24 02:26

JSONCPP has a writer, but all it seems to do is get info from the parser and then output it into a string or a stream. How do I make it alter or create new objects, arrays,

5条回答
  •  囚心锁ツ
    2020-12-24 03:01

    #include 
    #include 
    #include 
    
    void main()
    {
        std::ofstream file_id;
        op_file_id.open("file.txt");
    
        Json::Value value_obj;
        //populate 'value_obj' with the objects, arrays etc.
    
        Json::StyledWriter styledWriter;
        file_id << styledWriter.write(value_obj);
    
        file_id.close();
    }
    

提交回复
热议问题