users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to redirect stdout


From: Lindsey Spratt
Subject: Re: How to redirect stdout
Date: Mon, 28 Feb 2005 14:59:49 -0500


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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]