From: "Jon A. Lambert" Date: 2005-09-27T14:01:25+09:00 Subject: Re: IO#getc behavior Thanks Simon and Sean.. By way of followup to anyone having similar problems ... I had success with this: if RUBY_PLATFORM =~ /win32/ require 'Win32API' Kbhit = Win32API.new("msvcrt", "_kbhit", [], 'I') Getch = Win32API.new("msvcrt", "_getch", [], 'I') def getkey sleep 0.01 return nil if Kbhit.call.zero? c = Getch.call c = Getch.call + 256 if c.zero? || c == 0xE0 c end else def getkey select( [$stdin], nil, nil, 0.01 ) ? c = $stdin.getc : c = nil end end You've got to check getch for extended scancodes. Also I use an echo/no echo option later in the code and found getche() works like Unices getc() in that regard and to get Unices getc() to not echo and still allow CTL-C interrupts handled by Ruby I had to do this upon starting... if !WIN32 && $opts.echo system('stty cbreak -echo') end and this upon exiting.. if !WIN32 && $opts.echo system('stty -cbreak echo') end -- J Lambert