Reputation: 1
How to put stars *
in the password field when user enters password?
In turbo we can use getch()
but it is not available in gcc.
What would you suggest?
Upvotes: 0
Views: 328
Reputation: 5537
Use the tcsetattr(3) function. In your termios structure, you'll need to unset ICANON (canonical mode), and ECHO (character echo). Then you can read the characters from the input one at a time, outputting an asterisk after each character input.
Upvotes: 2
Reputation: 799150
You can use termios(3)
to control various characteristics of the terminal, such as whether or not it echoes typed characters.
Upvotes: 2