When using a tty-based interface (available only on UNIX platforms), IDL sends its output to the screen for the user to see. When using a GUI-based interface (any platform), the output goes to the IDL log window. The default output function is automatically installed by IDL at startup. To divert IDL output to a function of your own design, use IDL_ToutPush() and IDL_ToutPop() to change the output function called by IDL.
Internally, IDL maintains a stack of output functions and provides two functions (IDL_ToutPush() and IDL_ToutPop()) to manage them. The most recently pushed output function is called to output each line of text. Output functions of your own design should have the following type definition:
typedef void (* IDL_TOUT_OUTF)(int flags, char *buf, int n)
The arguments to an output function are:
A bitmask of flag values that specify how the text should be output. The allowed bit values are:
Send the text to stderr rather than stdout, if that distinction means anything to your output device.
After outputting the text, start a new output line. On a tty this is equivalent to sending a newline ('\n') character.
The text to be output. There may or may not be a NULL termination, so the character count provided by n must be used to move only the specified number of characters.
The number of characters in buf to be output.
Use IDL_ToutPush() to push a new output function onto the stack. The most recently pushed function is the one used by IDL for output.
void IDL_ToutPush(IDL_TOUT_OUTF outf)
IDL_ToutPop() removes the most recently pushed output function. The removed function pointer is returned.
Note: Do not pop an output function you did not push. It is an error to attempt to remove the last remaining function.