On 10/1/06, Nebiru <Nebiru / gmail.com> 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?
> >
> > Thanks.
>
> Not sure if this is quite what your looking for but I generally do
> something like
> def get_keypress
>     system "stty raw -echo"
>     STDIN.getc
> ensure
>     system "stty -raw echo"
> end
>
> key = get_keypress.chr
>
>
>

It works.Thank you very much.  :)

And thanks all.