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
[Caml-list] How to read three integers from a text-file... ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-04-25 (06:33)
From: Tomasz Zielonka <zielony@c...>
Subject: Re: pervasives (was: Re: [Caml-list] How to read three integers from a text-file... ?)
On Wed, Apr 24, 2002 at 10:30:48PM -0700, Chris Hecker wrote:
> I was about to answer, "why not just use read_int in a loop from the 
> in_channel?", but then I looked and it's only defined on stdin (as is 
> read_float).

val read_int : unit -> int
(** Flush standard output, then read one line from standard input
   and convert it to an integer. Raise [Failure "int_of_string"]
   if the line read is not a valid representation of an integer. *)

This function assumes that every integer is on a separate line. This is
rarely true in programming contests.

> Chris


Tomek Zielonka <>
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: