|
Hi, Gonna give youthe answer I got some time ago (the same question !). Things work by the solution (1) but more generaly by (2). Regards. Alexandre. ______________________________________________________________ 1- .... Here is what I did (essentially your example but in two steps):
Best regards,
Johannes
$ gprolog
GNU Prolog 1.2.18
By Daniel Diaz
Copyright (C) 1999-2004 Daniel Diaz
| ?- [user].
compiling user for byte code...
entier(0).
entier(succ(N)) :- entier(N).
user compiled, 3 lines read - 348 bytes written, 8476 ms
(1 ms) yes
| ?- open(fichier,write,F), current_input(I), current_output(O),
asserta(streams(F,I,O)),
'$set_top_level_streams'(I, F),entier(succ(succ(0))).
| ?- retract(streams(F,I,O)),
'$set_top_level_streams'(I, O), close(F).
F = '$stream'(2)
I = '$stream'(0)
O = '$stream'(1)
(1 ms) yes
| ?- halt.
$ cat fichier
F = '$stream'(2)
I = '$stream'(0)
O = '$stream'(1)
yes
$
___________________________________________________________ 2- via script cpmmand : Following my question about "stdout redirection in Gprolog", Gurvan Le Guernic gave a general answer ("script" command under Unix/Linux) that did the job. I post it hereby. This works not only for Gprolog but also for any command. In order to gather (to mirror) outputs, launch " script -c gprolog myfile" and "myfile" is a mirrir of the stdout : (see "man script" also). Here's an example (sorry for Windoz users !): --------------------------------------------------------- [EMAIL PROTECTED]:> script -c gprolog toto Le script a débuté, le fichier est toto GNU Prolog 1.2.16 By Daniel Diaz Copyright (C) 1999-2002 Daniel Diaz | ?- write(1). 1 yes | ?- listing. yes ....................... | ?- halt. Script complélé, le fichier est toto [EMAIL PROTECTED]:> [EMAIL PROTECTED]:> cat toto Le script a débuté sur mar 01 mar 2005 19:58:00 CET GNU Prolog 1.2.16 By Daniel Diaz Copyright (C) 1999-2002 Daniel Diaz | ?- write(1). 1 yes | ?- listing. yes ..................... | ?- halt. Script complété sur mar 01 mar 2005 19:58:10 CET --------------------------------- Cliff Bender a écrit : Hi, -- 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 |
begin:vcard fn:A-S Saidi n:Saidi;Aleksander-Sadegh org;quoted-printable:Ecole Centrale de Lyon, D=C3=A9p MI;LIRIS-CNRS UMR 5205 adr:;;36 ave. Guy de Collongue;Ecully;Rhone;69134;France email;internet:[EMAIL PROTECTED] title;quoted-printable:Ma=C3=AEtre de Conf=C3=A9rences tel;work:04.72.18.65.30 tel;fax:04.78.33.16.15 x-mozilla-html:TRUE url:http://www.mi.ec-lyon.fr version:2.1 end:vcard
_______________________________________________ Users-prolog mailing list [email protected] http://lists.gnu.org/mailman/listinfo/users-prolog
