-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathecho.cpp
48 lines (39 loc) · 908 Bytes
/
echo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "tinyxml.h"
#include <time.h>
#include <fstream>
using namespace std;
int main( int argc, char* argv[] )
{
if ( argc < 2 )
{
printf( "Loads a file, then writes it back out.\n" );
printf( "Usage: echo inputfile\n" );
return 1;
}
clock_t start = clock();
TiXmlDocument doc( argv[1] );
doc.LoadFile();
if ( doc.Error() )
{
printf( "Error loading document.\n" );
printf( "Error id=%d desc='%s' row=%d col=%d\n",
doc.ErrorId(), doc.ErrorDesc(), doc.ErrorRow(), doc.ErrorCol() );
return 2;
}
printf( "Load '%s' successful.\n", doc.Value() );
/*
#ifdef TIXML_USE_STL
printf( "STL mode on.\n" );
doc.SaveFile( "echotest.stl.xml" );
#else
printf( "STL mode OFF.\n" );
#endif
doc.SaveFile( "echotest.xml" );
doc.Print( stdout, 0 );
*/
TiXmlPrinter printer;
doc.Accept( &printer );
clock_t end = clock();
printf( "Clocks: %d\n", (int)(end-start) );
return 0;
}