Ruby 在 Windows 下读取键盘输入

2015-09-26 0 688
Ruby 在 Windows 下读取键盘输入
require 'Win32API'

def getch
  @getch ||= Win32API.new('crtdll', '_getch', [], 'L')
  @getch.call
end

while (c = getch) != ?\e
  puts "You typed #{c.chr.inspect}"
end

遇见资源网 ruby Ruby 在 Windows 下读取键盘输入 http://www.ox520.com/16462.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务