<< DisableInteractiveMode call_scilab API (Scilab engine) GetLastJob >>

Scilab Help >> call_scilab API (Scilab engine) > ExecScilabCommand

ExecScilabCommand

Execute a Scilab from a C/C++ code (call_scilab) and can get message and callstack on error.

int ExecScilabCommand(char* cmd, char** msg, char** stack)

Description

This fonction is provided in call_scilab. This function execute a command by the Scilab engine.

In case of error, it can fill buffers to get error message and/or callstack information.

Arguments

cmd

a standard C char* containing the Scilab commands

msg

in case of error during execution and if msg != NULL, engine will fill buffer with error message

msg must be free.

stack

in case of error during execution and if stack != NULL, engine will fill buffer with callstack information

stack must be free.

returns

0 if the execution is successful.

-1 if the execution fails.

Examples

// A simple ExecScilabCommand example

StartScilab(NULL, NULL, 0);

char* errmsg = NULL;
char* errstack = NULL;
int err = ExecScilabCommand((char*)"cosd(\"a\")", &errmsg, &errstack);
if (err)
{
    std::cout << "Msg: " << errmsg << std::endl;
    std::cout << "Stack: " << errstack<< std::endl;

    free(errmsg);
    free(errstack);
}

See also


Report an issue
<< DisableInteractiveMode call_scilab API (Scilab engine) GetLastJob >>