Re: How to redirect stdout

Lindsey Spratt <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
On Feb 28, 2005, at 1:26 PM, Alexandre Saidi wrote:

> I'm looking for how to redirect things displayed under Gnu Prolog.

Call current_input/1 or current_output/1 with a variable to get the 
name of the current input or output stream, respectively.
Use open/4 or open/3 to create a "stream" and get an atom X identifying 
it, then
use set_input/1 or set_output/1 with X.
When done with the redirected stream, use set_input/1 or set_output/1 
to restore the original stream.
Finally, call close/1 on the stream X. (See sections 7.10.1 through 
7.10.7 in the GProlog manual.)

The deprecated, but simpler, way to do all of this is to use see/1, 
seeing/1, seen to handle the input stream redirection and tell/1, 
telling/1, told to handle the output stream redirection. (Section 7.16)

HTH,
Lindsey Spratt
http://homepage.mac.com/~lspratt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.