From: Pierre Weis <Pierre.Weis@inria.fr>
To: Michel.Levy@imag.fr (Michel Levy)
Cc: caml-list@inria.fr
Subject: Re: print and output
Date: Thu, 3 Jul 1997 09:54:29 +0200 (MET DST) [thread overview]
Message-ID: <199707030754.JAA21557@pauillac.inria.fr> (raw)
In-Reply-To: <v01530501afde7af99a9d@[129.88.38.40]> from Michel Levy at "Jul 1, 97 10:43:09 am"
Bonjour,
> Quand j'ecris (en Ocaml) le "programme" suivant :
> print_string ">>"; read_int ();;
> l'impression a lieu apres la lecture, ce qui me surprend, car il est dit
J'ai essaye' vos diffe'rentes versions, et toutes marchaient comme
vous vous y attendez. Je pense que votre proble`me vient peut-e^tre du
fait que vous utilisez la bibliothe`que Format. En ce cas, il y a un
retard a` l'impression car il faut attendre le mate'riel d'impression
pour pouvoir imprimer correctement. Si vous avez effectivement fait
open Format, il vous faut vider la queue d'impression avec
print_flush. E'crivez:
print_string ">>"; print_flush (); read_int ();;
Ou bien appelez directement la primitive de base:
Pervasives.print_string ">>"; read_int ();;
> Hi
>
> When I write (in OCAML) the following program :
> print_string ">>"; read_int ();;
> the reading takes place before the printing, what surprises me.
I tried your programs and they work fine, as you expect them to
work. My guess is that you don't use the basic print_string function,
but the one of the Format library module. That may be the case if you
have already open the Format module. In that case, you need to
flush the formatting queue with print_flush. You may write
print_string ">>"; print_flush (); read_int ();;
Alternatively, you may directly call the standard primitive with:
Pervasives.print_string ">>"; read_int ();;
Pierre Weis
INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/
prev parent reply other threads:[~1997-07-03 7:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-07-01 9:43 Michel Levy
1997-07-02 18:43 ` Adam P. Jenkins
1997-07-03 7:54 ` Pierre Weis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199707030754.JAA21557@pauillac.inria.fr \
--to=pierre.weis@inria.fr \
--cc=Michel.Levy@imag.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox