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)
SP_UserStreamPostHook *SP_set_user_stream_post_hook(SP_UserStreamPostHook *hook)
These hook functions must be called before
(see Initializing the Prolog Engine). In custom built
development systems, they may be called in the hook function
SU_initialize(). See The Application Builder.