Click to See Complete Forum and Search --> : How do I hide the password on console ?


ujjwal_rp
June 5th, 2003, 07:40 AM
I m writing a C program which requires a password to be typed on a console. How do I make the password appear as "****" ?

dimm_coder
June 5th, 2003, 08:14 AM
Read about _getch() (or smth similar).

for ex. read one char but type '*' to echo:

char ch = _getch();
_putch('*');

ps. Ussualy in Unix telnet sessions '*' not puts in output for input char, so noone can see number of chars in password.

ujjwal_rp
June 6th, 2003, 12:27 AM
Thanks dimm,
it worked.