#include <stdio.h>
#include <unistd.h>
#include "mjson.h"
Go to the source code of this file.
|
| int | main (int argc, char *argv[]) |
| |
◆ main()
| int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 5 of file mjson_test.cxx.
6{
7 std::string sin;
8
9 while (1) {
10 char buf[100];
11 int rd =
read(0, buf,
sizeof(buf)-1);
12 if (rd <= 0)
13 break;
14 buf[rd] = 0;
15 sin += buf;
16 }
17
18
19
20
21 MJsonNode*
n = MJsonNode::Parse(sin.c_str());
23 printf("Parse returned NULL!\n");
24 return 1;
25 }
27 std::string sout =
n->Stringify();
28 printf("Output JSON:\n");
29 printf("%s\n", sout.c_str());
31 return 0;
32}