Use getch() to get the input instead of using cin , so the input will not be shown (quoting wiki): int getch(void) Reads a character directly from the console without buffer, and without echo.
c - Hide password input on terminal - Stack Overflow.
maskpass() maskpass() is a Python module that can be used to hide passwords of users during the input time. The maskpass() modules also provides a secure way to handle the password prompt where programs interact with the users via terminal.
Possible Duplicate:
Read a password from std::cin
I don't work normally with the console, so my question is maybe very easy to answer or impossible to do .
Is it possible to "decouple" cin
and cout
, so that what I type into the console doesn't appear directly in it again?
I need this for letting the user typing a password and neither me nor the user normally wants his password appearing in plaintext
on the screen.
I tried using std::cin.tie
on a stringstream
, but everything I type is still mirrored in the console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With