Re: How to redirect stdout
Alexandre Saidi <[email protected]>
| Newsgroups | gmane.comp.gnu.prolog.general |
|---|---|
| Organization | ECL |
| Message-ID | <[email protected]> |
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 ?
regards.
AS
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)
>
> HTH,
> Lindsey Spratt
> http://homepage.mac.com/~lspratt
>
>
--
Aleksander S. Saidi
Ecole Centrale de Lyon
Département Mathématiques-Informatique
Mél : [email protected]
Tél : 04.72.18.65.30, Fax : 04.78.33.16.15