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-24 (10:34)
From: Jacek Chrzaszcz <chrzaszcz@m...>
Subject: [Caml-list] How to read three integers from a text-file... ?

Hello list,

Is there a clean way (a one-liner) to read a constant number of
integers separated by whitespace from a text-file (or stdin) ?

I mean something like 
scanf("%d%d%d",&a,&b,&c) in C, or
readln(a,b,c) in Pascal

I know I can use String.index, Str.split or read char by char (this
sucks), but you have to admit the Pascal or even C versions are more

I am asking this question, because our students want to use Ocaml for
competing in various programming contests, where the comfort and speed
(of programming) are essential.

Moreover in such contests the use of external libraries (Str) if often

If the easy way of doing this is missing, may I suggest adding it to
the standard library?

Jacek Chrzaszcz
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