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-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 Archives:
Bug reports: FAQ:
Beginner's list: