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 (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 <chrzaszcz@mimuw.edu.pl>
> > 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 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