c++ - rapidjson: working code for reading document from file? -


i need working c++ code reading document file using rapidjson: https://code.google.com/p/rapidjson/

in wiki it's yet undocumented, examples unserialize std::string, haven't deep knowledge of templates.

i serialized document text file , code wrote, doesn't compile:

#include "rapidjson/prettywriter.h" // stringify json #include "rapidjson/writer.h"   // stringify json #include "rapidjson/filestream.h"   // wrapper of c stream prettywriter output [...] std::ifstream myfile ("c:\\statdata.txt"); rapidjson::document document; document.parsestream<0>(myfile); 

the compilation error state: error: 'document' not member of 'rapidjson'

i'm using qt 4.8.1 mingw , rapidjson v 0.1 (i try upgraded v 0.11 error remain)

the filestream in @raanan's answer apparently deprecated. there's comment in source code says use filereadstream instead.

#include <rapidjson/document.h> #include <rapidjson/filereadstream.h>  using namespace rapidjson;  // ...  file* pfile = fopen(filename.c_str(), "rb"); char buffer[65536]; filereadstream is(pfile, buffer, sizeof(buffer)); document document; document.parsestream<0, utf8<>, filereadstream>(is); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -