|
-
April 15th, 1999, 12:33 PM
#1
How to display password as '*' in DOS program
In a console program, I would prompt the user for a password.
Can someone show me the code on how to accept the input characters
and display them on the screen as a string of '*'s ?
Thanks.
-
April 15th, 1999, 02:38 PM
#2
Re: How to display password as '*' in DOS program
#include <stdio.h>
#include <conio.h>
void main(void)
{
printf("Enter Password:");
char pw[65];
int i;
i = 0;
char c;
c = _getch();
while(c != char(0x0D) && i < 64)
{
putch('*');
pw[i] = c;
i++;
c = _getch();
}
pw[i] = 0x00;
printf("\n\nPassword entered was:%s\n",pw);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|