This module provides temporary input/output redirection. The predicate with_output_to/2 re-directs the output for the given goal and retrieves the stream content for each success. The predicate with_input_from/2 redirects the input for the given goal.Examples:
?- with_output_to(atom(A), (write(foo); write(bar))).
A = foo ;
A = bar ;
?- with_input_from(atom('foo.\n'), read(X)).
X = foo ;
The predicate with_output_to/2 is non-deterministic for non-deterministic goals and will return different data results for each success. The predicate with_output_to/2 and with_input_from/2 recognize the same data formats.
The following charsio predicates are provided: