Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!cs.utexas.edu!romp!auschs!awdprime!ziggy.austin.ibm.com!ehill From: ehill@ziggy.austin.ibm.com Newsgroups: comp.lang.pascal Subject: Re: "Dots will echo:" for passwords... Message-ID: <6556@awdprime.UUCP> Date: 10 Apr 91 18:42:47 GMT References: <40822@netnews.upenn.edu> Sender: news@awdprime.UUCP Distribution: na Organization: IBM AWD, Austin Lines: 42 In article <40822@netnews.upenn.edu> garay@hyper.lap.upenn.edu (John Garay) writes: > >I'm interested in a procedure in TP which will echo dots to the screen instead >of the actual keys pressed. In other words, one of the ol' > 'Please type in password (dots will echo):' >types of things. The form I have now (w/ the password broadcasted on the >screen is: clrscr; > writeln ('Please Type Password:'); > readln (password); > >I figure somewhere between the writeln and the readln there's got to be a way >to make dots echo instead of the (secret) password. Any ideas, anyone? >A little background: IBM TP3.01 (WAIT! I'm interested in ideas with any >TP version!). Thanks much for the help.... -------- Try this piece of (TP5.5) code for reading the password: VAR password : string; ch : char; i : integer; i := 0; repeat ch := readkey; {-I don't know if readkey exists in TP3.01} if ch <> #13 then begin inc(i); {-increment string index counter} password[i] := ch; {-add char to password} write('.'); {-echo dot} end; until ch = #13; {-exit on carriage return} password[0] := chr(i); {-set stringlen byte } --------- This is a very simple routine, it does not allow for backspacing. I'll leave that as an exercise for you. Hope this helps you. - Ed Hill Personal Programming Center - IBM Austin Internet: ehill@wombat.austin.ibm.com -