From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA04582; Thu, 8 Aug 2002 19:47:30 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA04405 for ; Thu, 8 Aug 2002 19:47:29 +0200 (MET DST) Received: from postfix2-1.free.fr (postfix2-1.free.fr [213.228.0.9]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g78HlSn25621 for ; Thu, 8 Aug 2002 19:47:28 +0200 (MET DST) Received: from lfs (strasbourg-4-a7-62-147-192-111.dial.proxad.net [62.147.192.111]) by postfix2-1.free.fr (Postfix) with SMTP id 8D0D8379 for ; Thu, 8 Aug 2002 19:47:27 +0200 (CEST) Date: Thu, 8 Aug 2002 19:55:26 +0200 From: Nicolas FRANCOIS (AKA El Bofo) To: Caml List Subject: [Caml-list] Some troubles with stdout Message-Id: <20020808195526.6fe14fce.nicolas.francois@free.fr> X-Mailer: Sylpheed version 0.8.0 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk This is a Matrice.print function that doesn't give me what I expect from it : let print m = for i = 0 to D.lignes - 1 do print_string "( "; for j = 0 to D.colonnes - 1 do A.print m.(i).(j); flush stdout; print_string " " done; flush stdout; print_string ")"; print_newline () done; print_newline () m is of type A.elem array array (it's a matrix), and using it with A.elem = Num.num and A.print n = print_string (string_of_big_int n) i get this answer : # let m = Matrice_Z.parse (Stream.of_string "[[ 3, 4, -2, 1, -2],[ 1, -1, 2, 2, 7],[ 4, -3, 4, -3, 2],[ -1, 1, 6, -1, 1]]");; val m : Matrice_Z.elem = [|[|; ; ; ; |]; [|; ; ; ; |]; [|; ; ; ; |]; [|; ; ; ; |]|] # Matrice_Z.print m;; ( ) ( ) ( ) ( ) 34-21-21-12274-34-32-116-11- : unit = () # instead of the wanted : ( 3 4 -2 1 -2 ) ( 1 -1 2 2 7 ) ( 4 -3 4 -3 2 ) ( -1 1 6 -1 1 ) (which, I agree with you, is far from perfect). Where do I get it wrong with stdout channel ? What's the exact purpose of flush, and why does the outputs get mixed ? \bye -- Nicolas FRANCOIS http://nicolas.francois.free.fr A TRUE Klingon programmer does NOT comment his code ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners