tags:

views:

51

answers:

2

How to put * in the password field when user enter the password. Like in turbo we can use getch() but it is not available in gcc. Give me the other way

+1  A: 

You can use termios(3) to control various characteristics of the terminal, such as whether or not it echoes typed characters.

Ignacio Vazquez-Abrams
A: 

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.

Will