[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: reading 2 numbers, one following the other
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 17 Dec 2003 20:44:41 -0200
>i've got a simple and straightforward question regarding the
>implementation of file:read(). is it possible to read two numbers, one
>following the other, with different ranges? like in c, for example,
>assuming a file containing '12345', the code:
>
> (void)fscanf("%2d", &x);
> (void)fprintf(stdout, "%d!\n", x);
> (void)fscanf("%3d", &x);
> (void)fprintf(stdout, "%d!\n", x);
>
>gets you:
>
>12!
>345!
Try tonumber(file:read(2)) and tonumber(file:read(3))...
--lhf