[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: When to use sysread

Tanaka Akira

5/10/2005 3:20:00 PM

In article <20050510142749.GA53646@freeze.org>,
Jim Freeze <jim@freeze.org> writes:

> Uhm, what is the purpose of #sysread.
> In other words, when would I use it instead of just #read.

When you know neither a length nor a terminator of data available.

For example, telnet.rb uses IO#sysread. It reads from network until a
shell's prompt. But the length until the prompt is not known in
general. Also the prompt varies. If IO#read is used and longer
length is specified, it blocks forever.
--
Tanaka Akira