We have a C++ program, sometimes this program need to execute a user defined batch/shell/ant script. We are not able to control how this script runs. Is there a way to get the return code from C++ program?
Something like: exec a script.sh > status.tmp ?
We need to support both Windows and Linux.
Any ideas?
in linux just use
since the return value of the script is the return value of the system function. In Windows I'dont't know wether there is a similar function. If you used the Qt toolkit you could do something like this
QProcess process;
process.start( "yourShellCommand", QStringList( args );
and this would be really cross-platform..