Prev: termios Up: termios Top: Top

8.7.1. Example

Here's a function that prompts for a password with echoing turned off. Note the technique using a separate termios.tcgetattr() call and a try ... finally statement to ensure that the old tty attributes are restored exactly no matter what happens: