[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: reading 2 numbers, one following the other
- From: Pedro Martelletto <pbastos@...>
- Date: Wed, 17 Dec 2003 19:20:49 -0200
hi people,
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!
i know the above demonstrated example uses the same backend lua uses to
endorse io operations, so if it's a matter of implementing this feature,
that shouldn't be too difficult...
cheers,
-p.