Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* 3.10 changes for scanf
@ 2007-03-22 10:56 micha
  0 siblings, 0 replies; only message in thread
From: micha @ 2007-03-22 10:56 UTC (permalink / raw)
  To: caml-list


I have a file with one int per line and when reading it with:

            let x = (Scanf.fscanf log "%d" (fun n -> n)) in
            let y = (Scanf.fscanf log "%d" (fun n -> n)) in
            let w = (Scanf.fscanf log "%d" (fun n -> n)) in
            let h = (Scanf.fscanf log "%d" (fun n -> n)) in
	   ....

it works in 3.09, but 3.10 fails with: 
Exception: Scanf.Scan_failure "scanf: bad input at char number 1: \n"

so I must change the format string to " %d " (note the spaces around
%d) to eat the newline too, is this a desired change?
( the c version reads the numbers with just "%d", I'm not sure what's
the correct behavior)

cheers,
 Michael



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-22 10:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-22 10:56 3.10 changes for scanf micha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox