Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
print and output
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michel.Levy@i...
Subject: print and output

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
val read_int : unit -> int
        Flush standart output then ...

Quand j'ecris le "programme" suivant :
        output_string ">>"; read_int ();;
l'impression a lieu avant la lecture, ce qui est heureux.

Pourquoi cette diffence, car je pensais que :
        print_string = output_string stdout


When I write (in OCAML) the following program :
        print_string ">>"; read_int ();;
the reading takes place before the printing, what surprises me.

On the contrary, when I write :
        output_string ">>"; read_int ();;
the printing takes place before the reading, what is better.

Why this difference, whereas I thought that :
        print_string = output_string stdout

Michel Levy
D106 - Laboratoire LSR
B.P.72 - 38402 SAINT MARTIN D'HERES CEDEX - France
Tel : 0476827246
e.mail :