I have to execute command and return the result like cmd.
I just found out the only method for this requirement.I used popen function to execute command and return the result,and then used pclose() function to close the stream and process.
But if commands are never end,for example “ping 8.8.8.8 –t” ,I can’t close process by using pclose() function.
If I kill the child process created by popen() by task manager,the pclose function works OK.
How can I get the processID created by popen to kill ?
===================
And :
If I use _popen() in windows,what will I have to do to get PID?