How can I create a C++ Console application, compiled with GCC, portable to Linux and Windows, with a password prompt without echo (does not show the password as you type it)?
I would like something like those:
- with stars echo:
User: bob
Password: ******
- or without any echo at all
User: bob
Password:
I googled this for hours without finding any solution that were a Console application (usable with bash, dos, etc) compiled with GCC and portable to Windows and Linux.


Reply With Quote

At least if you want it to be secure. Password prompters usually attach directly to the terminal or even bypass the interuption mechanisms present in the system (usually by using some system call, at least under Unix) to avoid keyloggers sniffing the password. If you don't care about security, you can use readline or ncurses libraries.

Bookmarks