Raul wrote:
>  Do we have any portable way of reading stdio
>  and writing stdio (in sessions where it exists)
>  on a character by character basis?

Not that I'm aware of.  My first thought was to use (1!:11 ] 1 ; n,n+1)  
because e.g. (1!:1 ] 1) reads (a line of) stdin natively.
But 1!:11  doesn't seem to support this type of argument (it assumes all 
numeric filehandles are the results of 1!:21).

But if your stream is newline-delimited (or you're just confident it'll contain 
a newline after each reasonably-sized chunk), you
could abstract away the line-orientation of  (1!:1 ] 1), combine it with a 
buffer, and return a char from the buffer (beheading it)
or replenish the buffer from (1!:1 ]1) if it's empty.

-Dan

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to