6.6.3.1 Writing User-stream Hooks

The user-stream hook is, if defined, called during SP_initialize(). It has the following prototype:

     SP_stream *user_stream_hook(void *user_data, int which)

If the hook is not defined, SICStus will attempt to open the standard TTY/console versions of these streams. If they are unavailable (such as for non-console executables under Windows), the result is undefined.

It is called once for each stream. The which argument indicates which stream it is called for. The value of which is one of the following:

SP_STREAMHOOK_STDIN
Create stream for standard input.
SP_STREAMHOOK_STDOUT
Create stream for standard output.
SP_STREAMHOOK_STDERR
Create stream for standard error.

The set of possible values for which may be expanded in the future.

The hook should return a standard SICStus I/O stream, as described in Defining a New Stream.

See cpg-ref-SP_set_user_stream_hook, for details.


Send feedback on this subject.