[fpc-pascal] Readln a password
Bart
bartjunk64 at gmail.com
Tue Jan 3 13:36:07 CET 2017
On 1/3/17, Tony Whyman <tony.whyman at mccallumwhyman.com> wrote:
> Today, I also came up against the problem of how to read a password from
> the console without echo. With a bit of googling and code bashing, I
> have created the following cross-platform code from a "getpassword"
> function.
>
> repeat
> read(c);
> if c = #10 then break;
> write('*');
> Result += c;
> until false;
That does not handle BackSpace (or any other "special key") AFAICS?
Reminds me of one of my program I wrote > 2 years ago.
You could have backspace and escape in your password ;-)
I later implemented an inputfield (using crt unit and reading
key-input using BIOS routines) that behaved just like an edit control,
so it would correctly handle left, right, delete, backspace etc.
Ahh, the good old days of Turbo Pascal.
Sorry, getting a bit sentimental.
Bart
More information about the fpc-pascal
mailing list