Trans
9/30/2006 7:15:00 PM
Paul Lutus wrote:
> Luo Yong wrote:
>
> > Hi all,
> >
> > I found that the STDIN.getc seem using a buffered input.It can't
> > return anything until you enter a "\n".
> >
> > Is there any way to get a character directly from keyboard?
>
> As it turns out, this is a question that I have seen asked very often in
> Usenet groups over the years, for all computer languages. Here is the
> answer:
>
> Without exploiting external, OS-specific packages like "curses" or the
> features of particular compilers on specific platforms, you cannot do this.
> If you don't care whether your application remains portable between
> platforms and you are willing to invoke OS-specific external features, then
> there is always some way to do it.
>
> To put it another way, there is no Ruby way to do this.
Let's be honest. That's pretty sad. 30 years into the PC revolution and
it's now harder to poll a keyboard? Something is terribly wrong.
T.