mirror of
https://github.com/openharmony/third_party_jsoncpp.git
synced 2026-07-21 00:05:22 -04:00
update OpenHarmony 2.0 Canary
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#include "json/json.h"
|
||||
#include <iostream>
|
||||
/** \brief Write the Value object to a stream.
|
||||
* Example Usage:
|
||||
* $g++ streamWrite.cpp -ljsoncpp -std=c++11 -o streamWrite
|
||||
* $./streamWrite
|
||||
* {
|
||||
* "Age" : 20,
|
||||
* "Name" : "robin"
|
||||
* }
|
||||
*/
|
||||
int main() {
|
||||
Json::Value root;
|
||||
Json::StreamWriterBuilder builder;
|
||||
Json::StreamWriter* writer(builder.newStreamWriter());
|
||||
|
||||
root["Name"] = "robin";
|
||||
root["Age"] = 20;
|
||||
writer->write(root, &std::cout);
|
||||
delete writer;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user