MIDAS
Loading...
Searching...
No Matches
mjson_test.cxx
Go to the documentation of this file.
1#include <stdio.h>
2#include <unistd.h>
3#include "mjson.h"
4
5int main(int argc, char* argv[])
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 //printf("Input string:\n");
19 //printf("%s\n", sin.c_str());
20
21 MJsonNode* n = MJsonNode::Parse(sin.c_str());
22 if (n==NULL) {
23 printf("Parse returned NULL!\n");
24 return 1;
25 }
26 n->Dump();
27 std::string sout = n->Stringify();
28 printf("Output JSON:\n");
29 printf("%s\n", sout.c_str());
30 delete n;
31 return 0;
32}
33
34/* emacs
35 * Local Variables:
36 * tab-width: 8
37 * c-basic-offset: 3
38 * indent-tabs-mode: nil
39 * End:
40 */
41
int main()
Definition hwtest.cxx:23
DWORD n[4]
Definition mana.cxx:247
#define read(n, a, f)
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24