[fpc-pascal] Readln a password

Adriaan van Os fpc at microbizz.nl
Sun Nov 27 14:24:28 CET 2016

I wonder what the recommended way is to readln a password from console, as a standard Readln echoes 
the password.

1. SetConsoleMode seems to be Windows-specific

2. On Mac OS X, a loop with a Crt.ReadKey until char(13) works in Terminal.app, but behaves strange 
in the Xcode Console window (more precise, uses Crt doesn't seem to be compatible with the Xcode 

3. On Mac OS X, executing '/bin/stty -echo' gives an error message 'stty: stdin isn't a terminal' 
(both in Terminal.appand in the Xcode Console window)

4. I experimented with '/usr/bin/read -s -p Password:' but couldn't get it working from FPC.


Adriaan van Os

More information about the fpc-pascal mailing list