I need to read a password from standard input and wanted std::cin
not to echo the characters typed by the user...
How can I disable the echo from std::c
There's nothing in the standard for this.
In unix, you could write some magic bytes depending on the terminal type.
Use getpasswd if it's available.
You can system() /usr/bin/stty -echo
to disable echo, and /usr/bin/stty echo
to enable it (again, on unix).
This guy explains how to do it without using "stty"; I didn't try it myself.