IDL_ExecuteStr() executes a single IDL command, while IDL_Execute() takes an array of commands and executes them in order. In both cases, the commands are null terminated strings—just as they would be typed by an IDL user at the IDL> prompt.

It is important to realize that the full abilities of IDL are available at this point. Typically, the commands you issue will run IDL programs of varying complexity, including support routines written in IDL from the IDL Library (found via the IDL !PATH system variable). This ability to “download” complicated programs into IDL and then run them via a simple command can be very powerful.


IDL_Execute() executes the command strings in the order given. It returns the value of !ERROR_STATE.CODE after the final command has executed. If the value of !ERROR_STATE.CODE is needed for an intermediate command, use IDL_ExecuteStr() instead of IDL_Execute().

int IDL_Execute(int argc, char *argv[]);


The number of commands contained in argv.


An array of pointers to NULL-terminated strings containing IDL statements to execute.


IDL_ExecuteStr() returns the value of the !ERROR_STATE.CODE system variable after the command has executed.

int IDL_ExecuteStr(char *cmd);


A NULL-terminated string containing an IDL statement to execute.