If you write the software in an windows environment and C++ it is very easy (PasswordCharacter='*')
If you have a Dos or simple Unix environment you have to do it by your own.
* Turn off echo (ioctl)
* read a character from stdin and
* write the Passwordcharacter to stdout
do
{
buffer[counter] = c = getch(); /*Use non-ANSI function to get from keyboard without writing to screen*/
putc('*',stdout);
counter++;
}
while ( c != 13 && counter < 31);
buffer[counter] = 0; /*Put a null character at the end of the string!*/
printf("\npassword is --> %s", buffer); /*Print out password*/
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.