stdin. Out 
becomes
stdout. If Error equals Out an 
unbuffered stream is associated to the same destination and linked to stderr. 
Otherwise Error is used for stderr. Output 
buffering for
Out is set to line and buffering on Error is 
disabled. The operating system I/O streams are shared across all 
threads. The three streams must be related to a file descriptor 
or a
domain_error file_stream is raised. See also
stream_property/2, 
property file_no(Fd).
Where set_prolog_IO/3 
rebinds the Prolog streams user_input,
user_output and user_error for a specific 
thread providing a private interactive session, set_system_IO/3 
rebinds the shared console I/O and also captures Prolog kernel events 
(e.g., low-level debug messages, unexpected events) as well as messages 
from foreign libraries that are directly written to stdout 
or
stderr.
This predicate is intended to capture all output in situations where standard I/O is normally lost, such as when Prolog is running as a service on Windows.