execScript()

Allows to execute a script during runtime. Use this function for void main-functions (without return value).

Synopsis

int execScript(string script, [dyn_string dollars [,<type> <arg> ...]] )

Parameters

Parameter Description
script The executed script
dollars The $parameter of the script
arg The parameters of any existing main function

Return value

The function returns 0 if an execution has been successful or in event of an error, -1.

Error

An error can be, for example, a syntax error of a script or a missing main function.

Description

Allows to execute a script during runtime.

Example

The following script adds the values 17 and 8.

main()
{
  int rc = execScript(
      "int main(int a, int b)" +
      "{" +
      "  int val;" +
      "  val = 3;" +
      "  DebugN(\"$ Value:\", $val1 + \" val:\", a + b );" +
      "}",
      makeDynString("$val1:12345"), 17, 8);
  DebugN(rc);
}

Assignment

Miscellaneous functions, waiting CONTROL function

Availability

CTRL