__system2
Syntax
__system2(string, &output)
Parameters
stringThe command line used to start an external application. In some cases, the full path is needed. If it contains space characters, quotation marks escaped with backslashes (
\") can be added to encapsulate the path, and, separately, the arguments to the application, like this:"\"D:\\My projects\\my app\\app.exe\" \"some argument\"".
outputThe output returned from the application. Both the
stdoutand thestderrstreams are stored in this variable.
Return value
The exit code returned from the external application. If the application could not be launched or fails to return an appropriate exit code, 1 is returned.
For use with
All C-SPY drivers.
Description
This macro launches an external application. The output from both the stdout and the stderr streams is stored in output. If no data has been received from the launched application within the timeout setting, or when the returned data exceeds the maximum data setting, the application is terminated. This restriction prevents the Embedded Workbench IDE from freezing or crashing because of misbehaving applications. By default, the timeout setting is 10 seconds, and the maximum data setting is 65,535 bytes.
Example
__var exitCode;
__var out_err;
exitCode = __system2("dir /S", &out_err);
__message "Output from the dir command:";
__message out_err;__setSystemTimeout, __setSystemMaxData, __system1, and __system3.