develooper Front page | perl.perl6.internals | Postings from December 2001

Okay, I finally broke down...

From:
Dan Sugalski
Date:
December 28, 2001 12:53
Subject:
Okay, I finally broke down...
Message ID:
5.1.0.14.2.20011228154909.020e3c40@pop.sidhe.org
And added a readline op. And abused the open op. (Both of which are 
temporary, and for debugging purposes/hacking about only!)

The signature is

    open Ix, Sy[, Sz]

to open file Y (with optional mode Z, defaults to r+) and stick the 
resulting FILE * into Ix. (Yes, FILE *. I'm casting a pointer to an 
integer. I *told* you this was nasty)

And to read a line,

    readline Sx, iy

to read a line (with fgets, max 64K-2 chars) into Sx from the FILE * in Y. 
If Y is the constant 0, 1, or 2 (or the integer register contains 0, 1, or 
2) then we use stdin/stdout/stderr as appropriate.

No, print doesn't take a filehandle arg. If someone wants to add it, go ahead.

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About