The easiest solution would be to use a non echoing input like
getch() (In
conio.h or
curses.h [Non standard])
Something like:
Code:
#include<stdio.h>
int main()
{
char a[10], c;
int i=0;
c = ' ';
printf("Enter the password: ");
while (c != 13)
{
c = (char)getch();
a[i] = c;
printf("*");
i++;
}
printf("\nPassword was: %s\n",a);
return 0;
}
I don't know of a
standard function that does the same. Someone else here might.
In Python (If anyone's interested), getting a password is as easy as:
Code:
import getpass
pswd = getpass.getpass("Enter Password: ")
print pswd
(All it does is hide input [Again, non echo], Unix style)