[代码] ruby代码
01 | require 'Win32API' |
02 |
03 | def getch |
04 | @getch ||= Win32API. new ( 'crtdll' , '_getch' , [], 'L' ) |
05 | @getch .call |
06 | end |
07 |
08 | while (c = getch) != ?\e |
09 | puts "You typed #{c.chr.inspect}" |
10 | end |