exec#

Purpose#

Executes an executable program and returns the exit code to GAUSS.

Format#

ret = exec(program, comline)#
Parameters:
  • program (string) – the name of the program, including the extension, to be executed.

  • comline (string) – the arguments to be placed on the command line of the program being executed.

Returns:

ret (scalar) –

the exit code returned by program.

If exec can’t execute program, the error returns will be negative:

-1

file not found

-2

the file is not an executable file

-3

not enough memory

-4

command line too long

Examples#

ret = exec("atog", "comd1.cmd");

// If 'ret' is nonzero
if ret;
   errorlog "atog failed";
   end;
endif;

In this example the ATOG ASCII conversion utility is executed under the exec() function. The name of the command file to be used, comd1.cmd, is passed to ATOG on its command line. The exit code ret returned by exec() is tested to see if ATOG was successful; if not, the program will be terminated after printing an error message. See ATOG .