On May 7, 2005, at 4:48 PM, Ryan Leavengood wrote: > Here is a Windows version that I just wrote: > > require 'Win32API' > > @getch = Win32API.new("crtdll", "_getch", [], 'L') > > def ask_password(prompt) > print prompt > pass = '' > while ((c = @getch.call) != 13) > pass << c.chr > end > pass > end > > pass = ask_password("Please give me your password: ") > puts > puts "Got '#{pass}'" > __END__ > > There may be a better way, but this works. James, feel free to put > this in HighLine, just give me the credit :) I have a question about this solution. You're stopping when you see a carriage-return above, but what does Windows really tact onto the end of the line? Is it a carriage return line feed pair, as I suspect? Put another way, if you changed the above from 13 to 10, would it still work? Thanks. James Edward Gray II P.S. I'm not a Window's user. That should be painfully obvious by now, but I just wanted to explain why I'm asking so many dumb questions. :)