From: AW Date: 2002-12-23T10:01:49+09:00 Subject: Re: How to read a single character from DOS prompt in windows (without )? Im not understanding what the problem is? I tried the script and seems to work like its suppost to. maybe your using doskey? AW Usano wrote: > Hmmmm. This worked ok in my little test file, but the character is > still in a buffer somewhere. In my program, I hit 'n' to not do > something, then 'puts' to the command line with no problem -- then > when I do a 'gets' the 'n' prints out. What the heck? > > - Usano > > require 'Win32API' > > print "Question? (Y/N): " > char = Win32API.new('crtdll', "_getch", [], 'L').Call > putc char > putc ?\n > if [?y,?Y].include? char > puts "You pressed 'Y'" > else > puts "You pressed something other than 'Y'" > end > gets # this prints the 'y' or 'n' !!! >