[Top][All Lists]

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

Re: How to redirect stdout

From: Alexandre Saidi
Subject: Re: How to redirect stdout
Date: Tue, 01 Mar 2005 09:04:16 +0100
User-agent: Mozilla Thunderbird 0.7 (X11/20040615)

Thanks for your help.

I'd already tried :

| ?-open('/home/alex/fichier',write,F), current_output(Old), set_output(F), a_call, close(F), set_output(Old).

But the file 'fichier' is of size 0 !

So what's wrong with my code?
should I flush something ?



Lindsey Spratt a écrit :

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)

Lindsey Spratt

Aleksander S. Saidi
Ecole Centrale de Lyon
Département Mathématiques-Informatique
Mél : address@hidden
Tél :, Fax :

reply via email to

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