From: Wai Tsang Date: 2007-08-26T10:05:07+09:00 Subject: Re: Newbie questions Bertram Scharpf wrote: > Hi, > > Am Sonntag, 26. Aug 2007, 07:00:06 +0900 schrieb William James: >> On Aug 25, 3:05 pm, "Barr, Keith" wrote: >> > I have a menu that I would like users to respond to >> > simply by entering a single character. >> >> def getkey >> select( [$stdin], nil, nil, 0.01 ) ? c = $stdin.getc : c = nil >> end > > Why `c=卒? Why twice? > > It doesn't work here; it still waits for the enter key. > > I doubt whether there is any other way than using termios. > > Bertram It means if select( [$stdin], nil, nil, 0.01 ) return true, then c = $stdin.getc; otherwise c = nil. -- Posted via http://www.ruby-forum.com/.