English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 <t.zielonka@students.mimuw.edu.pl>
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