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 (13:40)
From: Tomasz Zielonka <zielony@c...>
Subject: Re: [Caml-list] How to read three integers from a text-file... ?
On Wed, Apr 24, 2002 at 08:16:16PM +0900, Jacques Garrigue wrote:
> From: Jacek Chrzaszcz <>
> > 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
> A clean way to do this is to use then Genlex module.

You can also use ocamllex and that's what I did recently to read strings
of digits (up to 170 digits). The contest won't probably accept the .mll
file, but you can send the ocamllex output itself. Such lexer is much
faster than Genlex generated one.  Bad thing is that the code will be
cluttered with lexer arrays, etc.


no sig
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: