Re: How to redirect stdout

Pedro Patinho <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Organization Universidade de Évora
Message-ID <20050301231237.3a067ad4@dukhmobile>
Hi,

GNU Prolog 1.2.18
By Daniel Diaz
Copyright (C) 1999-2003 Daniel Diaz
| ?- tell(xpto), write('Hello'), nl, told.

(1 ms) yes
| ?- 

$ cat xpto 
Hello
$

Best Regards,
Pedro.

Alexandre Saidi <[email protected]> wrote:
# Thanks Lindsey,
# I've been trying any thing I could to make it work.
# Ther's no way !
# As I said, I saw a mail in the FAQ saying that stdout is not affected
# by set_output.
# I'm using the version 1.2.16.
# Perhaps ther'is is a trick withe the interactive mode ?
# 
# Thanks any way.
# ---------------------------------------------
# Here's what I do under prolog (for a test) :
# alex@safran:~> gprolog
# GNU Prolog 1.2.16
# By Daniel Diaz
# Copyright (C) 1999-2002 Daniel Diaz
# | ?- [user].
# compiling user for byte code...
# toto :- true.
# 
# user compiled, 2 lines read - 207 bytes written, 4104 ms
# 
# yes
# | ?- open(fichier,write,F), current_output(Old), set_output(F),
# listing, flush_output(F), flush_output, close(F).
# 
# toto.
# 
# F = '$stream'(2)
# Old = '$stream'(1)
# 
# (1 ms) yes
# | ?- halt.
# alex@safran:~>
# 
# The file 'fichier' is empty.
# I've done many other tests with no success.
# ---------------------------------------------------------
# 
# Lindsey Spratt a écrit :
# > Perhaps flush_output(F) before the close(F), or simply
# > 'flush_output', would help.
# > Lindsey
# > 
# > On Mar 1, 2005, at 3:04 AM, Alexandre Saidi wrote:
# > 
# >> 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
# > 
# > 
# > 
# 
# -- 
# 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
# 
# 
# _______________________________________________
# Users-prolog mailing list
# [email protected]
# http://lists.gnu.org/mailman/listinfo/users-prolog
#
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.