From: Bill Kelly Date: 2005-08-10T00:25:36+09:00 Subject: Re: Poll STDIN for waiting input on Win32 Hi, From: "Bill Atkins" > > How can I determine if there's input waiting on STDIN before > calling gets? I just posted this a minute ago on the Threading+TCPServer thread; if I'd seen your message I'd have posted here instead... :) I use: if WINDOWS_VERSION require 'dl' $win32_console_kbhit = Win32API.new("msvcrt", "_kbhit", [], 'I') def console_input_ready? $win32_console_kbhit.call != 0 end else def console_input_ready? select([$stdin], nil, nil, 0) != nil end end Note that if you do a gets() when console_input_ready? is true, you'll still block until the user hits . BTW, I was using: WINDOWS_VERSION = (RUBY_PLATFORM =~ /win32/) != nil Regards, Bill