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 AAA28980; Mon, 7 Oct 2002 00:47:31 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA28983 for ; Mon, 7 Oct 2002 00:47:31 +0200 (MET DST) Received: from athlon.baretta.com (host186-68.pool80116.interbusiness.it [80.116.68.186]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g96MlT529338 for ; Mon, 7 Oct 2002 00:47:30 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id D38DA273AE for ; Mon, 7 Oct 2002 00:57:37 +0200 (CEST) Message-ID: <3DA0BFE1.9050302@baretta.com> Date: Mon, 07 Oct 2002 00:57:37 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: it, en MIME-Version: 1.0 To: Ocaml Subject: [Caml-list] Bug somewhere... Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk It's either on my brain or in the Scanf module, the former possibility being definitely more likely. I have written a very simple program to compute md5 checksums of a codes taken from a text file. Here it is: let scan_line () = Scanf.scanf "%[^\n\r]\n" (fun a -> a) let digest s = String.uppercase (Digest.to_hex(Digest.string s)) let digest_line s = print_endline (s ^ "#" ^ (digest s)) let _ = try while true do digest_line (scan_line ()) done with End_of_file -> () Seems very reasonable... Here's the input file: (2002) DMD.CSB.1GL.001.01 (2002) DMD.CSB.1GL.001.02 (2002) DMD.CSB.1GL.001.03 (2002) DMD.CSB.1GL.001.04 (2002) DMD.CSB.1GL.001.05 (2002) DMD.CSB.1GL.001.06 (2002) DMD.CSB.1GL.001.07 (2002) DMD.CSB.1GL.001.08 (2002) DMD.CSB.1GL.001.09 (2002) DMD.CSB.1GL.001.10 (2002) DMD.CSB.1GL.001.11 (2002) DMD.CSB.1GL.001.12 (2002) DMD.CSB.1GL.001.13 (2002) DMD.CSB.1GL.001.14 (2002) DMD.CSB.1GL.001.15 (2002) DMD.CSB.1GL.001.16 (2002) DMD.CSB.1GL.001.17 (2002) DMD.CSB.1GL.001.18 (2002) DMD.CSB.1GL.001.19 (2002) DMD.CSB.1GL.001.20 Now here's the output file: (2002) DMD.CSB.1GL.001.01#EA486F3F11C1D1E5BE6DDC2A444BC4E1 2002) DMD.CSB.1GL.001.02#4A3E838023756A5EE01C39D5DD02FC07 2002) DMD.CSB.1GL.001.03#605ED19A81C3B7748494038FEE93671A 2002) DMD.CSB.1GL.001.04#F475498E61CC896FA42B3869858B9B69 2002) DMD.CSB.1GL.001.05#60246106058EA46F7C5904F9A7D69FD7 2002) DMD.CSB.1GL.001.06#3FDF89041B44A8A3F5334B500A8B48A0 2002) DMD.CSB.1GL.001.07#657A508D402845454D5EAF0A2BC8380B 2002) DMD.CSB.1GL.001.08#230BDE6A530043CCB01434A6E19DB10E 2002) DMD.CSB.1GL.001.09#39CA6A302A6DE081DFC3BD24C8D4C38E 2002) DMD.CSB.1GL.001.10#BFBAE55D0808B5A8729E23459E45A617 2002) DMD.CSB.1GL.001.11#001F0B9F7F5EEDE05C8BA5A85F7D0F45 2002) DMD.CSB.1GL.001.12#77AB75131372E7FB723B280E084733B0 2002) DMD.CSB.1GL.001.13#1E605246D240D6B5735CDE40FF4614CC 2002) DMD.CSB.1GL.001.14#40970C955978A228AA308AB1B1169800 2002) DMD.CSB.1GL.001.15#7DED9C18A5700389CE670C9E8474C757 2002) DMD.CSB.1GL.001.16#8D396925D7867AF0BF2169B692EAECFF 2002) DMD.CSB.1GL.001.17#DEE78191DEF1E6BA7144AA14E29B8EE6 2002) DMD.CSB.1GL.001.18#F6E082FFD976B0A6721AC056C40C526E 2002) DMD.CSB.1GL.001.19#34F915DBF5B258C7BD4200C753C42BD1 2002) DMD.CSB.1GL.001.20#D310054DE7CF959F5946FABAF561FBEF The '(' is only present on the first line, indicating--so it seems--that scanf is eating-away one more character than it should every time. Do I need brain surgery or is there really a problem with scanf? Alex ------------------- 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