#########code 2
print "Enter password:\n"
pass = ''
while true
ca = STDIN.getc
print "\x08\x08\x08"
if ca.to_i ==10 then
break
end
pass << ca
end
pass.strip!
###### does not work
Any Help would be good. I also tried \b . I am running windows i am
using a bat file but i also tried rde it just prints the squares
#########code 2
print "Enter password:\n"
pass = ''
while true
ca = STDIN.getc
print "\x08\x08\x08"
if ca.to_i ==10 then
break
end
pass << ca end
pass.strip!
###### does not work
Any Help would be good. I also tried \b . I am running windows i am
using a bat file but i also tried rde it just prints the squares
The problem is that .getc will read a whole line at the time then buffer the characters and when all are used up it will read a whole line again etc.
So I guess the best you can do without using a terminal library is calling `cls` immediately after you read in the password.
Is there any documentation on cls? Or exmaples?
Becker
···
On Thu, 21 Oct 2004 13:49:23 +0900, Florian Gross <flgr@ccan.de> wrote:
ruby talk wrote:
> ######code 1
> print "monkey cat"
> print "\x08\x08\x08"
> ### works remves cat
>
> #########code 2
> print "Enter password:\n"
> pass = ''
> while true
> ca = STDIN.getc
> print "\x08\x08\x08"
> if ca.to_i ==10 then
> break
> end
> pass << ca
> end
> pass.strip!
> ###### does not work
>
> Any Help would be good. I also tried \b . I am running windows i am
> using a bat file but i also tried rde it just prints the squares
The problem is that .getc will read a whole line at the time then buffer
the characters and when all are used up it will read a whole line again etc.
So I guess the best you can do without using a terminal library is
calling `cls` immediately after you read in the password.