9.6.3 Hookable Standard Streams

As of release 3.7, the standard I/O streams (input, output, and error) are hookable, i.e. the streams can be redefined by the user.

SP_UserStreamHook *SP_set_user_stream_hook(SP_UserStreamHook *hook)
Sets the user-stream hook to hook.
SP_UserStreamPostHook *SP_set_user_stream_post_hook(SP_UserStreamPostHook *hook)
Sets the user-stream post-hook to hook.

These hook functions must be called before SP_initialize() (see Initializing the Prolog Engine). In custom built development systems, they may be called in the hook function SU_initialize(). See The Application Builder.