From: "Mehr, Assaph (Assaph)" Date: 2004-09-06T13:33:06+09:00 Subject: Re: Problem Having Ruby Wait for a User Input > Oh, your first link is broken. Both links work - just retested. If you have trouble accessing it go to www.ruby-doc.org, Core API, and select "lib/observer.rb" from under "Files". > Here is the code in question, it is intended to get only a single key press > for a limited range of keys. > >def key_input #Get arbitrary keyboard input > input = 0 > n = 0 > for i in 1..18 > if Input.trigger?(i) > n = i > end > end > if n > 0 > input = n > end > return input > end > >Does this clear anything up? There is no code above to get a character from std-in. If you want single characters from a stream you can use IO#getc, as in: a = STDIN.getc Or: a = STDIN.sysread(1) But both depend on the underlying OS buffering - i.e. you will not get the characters until the user feed the input line by presseing enter.