Skip to main content

IAR Embedded Workbench for RISC-V 3.40

__system2

In this section:
Syntax
__system2(string, &output)
Parameters
string

The 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\"".

output

The output returned from the application. Both the stdout and the stderr streams 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.