rapidjson 读取文件

一.用FileReadStream

FILE *fp = fopen("test.json" , "rb");

char readbuffer[6556];
FileReadStream frs(fp , readbuffer , sizeof(readbuffer));
Document doc;
doc.ParseStream(frs);
fclose(fp);


二.用IStreamWrapper

ifstream ifs("test.json");
IStreamWrapper isw(ifs);
Document doc;
doc.ParseStream(isw);

你可能感兴趣的:(rapidjson 读取文件)