Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

rapidjson write stringbuffer to file

#include <rapidjson/writer.h>
#include <fstream>

int main()
{
  rapidjson::StringBuffer sb;
  rapidjson::Writer<rapidjson::StringBuffer> writer(sb);
  
  writer.StartObject();
  writer.Key("myKey");
  writer.Uint(123);
  writer.EndObject();
  
  std::ofstream ofs("output.json");
  ofs << sb.GetString();
  ofs.close();
  return 0;
}
 
PREVIOUS NEXT
Tagged: #rapidjson #write #stringbuffer #file
ADD COMMENT
Topic
Name
5+8 =