In message <E14odjW-0006rX-00 / natsumi.home> henryso / earthling.net writes: > In [ruby-talk:13674], "Will Conant" <will_conant / hotmail.com> wrote: > > Is there a way for me to get a character from the terminal right as it > > is typed, rather than blocking until the user presses enter? Also, > > ruby automatically prints the characters out as the user types > > them... can this behavior be changed? > > Though I haven't actually used it in the context of Ruby, this is the sort of > thing curses (and thus the curses Ruby extension) does. Or, you just need echo-less non buffered input, use ruby-termios module which is now available from CVS. You can write: ruby -rtermios -e 'include Termios; t = getattr($stdin); t.c_lflag \ &= ~(ICANON~ECHO); setattr($stdin, TCSANOW, t);p $stdin.sysread(1)' for 1 character input as if you have `stty cbreak -echo'ed. # Using IO#sysread for avoiding stdio buffering. Yes, if you have useful stty, `system "stty -echo cbreak"' does ecough setting up. Of course you should restore terminal settings until your program ends. -- kjana / os.xaxon.ne.jp April 15, 2001 Never put off till tomorrow what you can do today.