Availability:built-in
stream_pair(?StreamPair, 
?Read, ?Write)This predicate can be used in mode (-,+,+) to create a
stream-pair from an input stream and an output stream. Mode 
(+,-,-) can be used to get access to the underlying streams. If a stream 
has already been closed, the corresponding argument is left unbound. If 
mode (+,-,-) is used on a single stream, either Read or
Write is unified with the stream while the other argument is 
left unbound. This behaviour simplifies writing code that must operate 
both on streams and stream pairs.
Stream-pairs can be used by all I/O operations on streams, where the 
operation selects the appropriate member of the pair. The predicate
close/1 
closes the still open streams of the pair.102As 
of version 7.1.19, it is allowed to close one of the members of the 
stream directly and close the pair later. The output stream 
is closed before the input stream. If closing the output stream results 
in an error, the input stream is still closed. Success is only returned 
if both streams were closed successfully.