c++ - TinyXML issue with VC++ -
i collecting netstat information. program working when in tinyxml tag shows null while in console application same program runs successfully
char command[50]; tixmlelement* msg31 = new tixmlelement( "port" ); tixmlelement childtext0( "type" ); tixmlnode* childnode0; cstring stemp; strcpy( command, "netstat -aon | findstr 3306" ); stemp.format(_t("%s"), system(command)); childtext0.value = "mysql_port" ; childtext0.linkendchild(new tixmltext(getchararray(stemp))); childnode0 = msg31->insertendchild( childtext0 ); childtext0.clear(); net->linkendchild(msg31);
this program runs sucessfully. problem in xml shows null value. output of xml below. problem code?
output of xml(you can see mysql_port null)
<network> <port> <mysql_port>(null)</mysql_port> </port> </network>
the return value of system()
int
, more exit code of executed program, supposed 0 if program succeeds.
so, yes, null pointer there.
see this question on how output itself.
Comments
Post a Comment