Opened 21 years ago

Closed 19 years ago

#20 deleted Support Requests (None)

passwords in c++ programming

Reported by: nobody Owned by: nobody
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

How would i hide the passwords by using (*** , i.e. 
asteriks signs ) in  c++ programming.

Attachments (1)

password.doc (23.5 KB ) - added by anonymous 15 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 by mohaps, 20 years ago

Logged In: YES 
user_id=110222

Hi,
 this code works on windows 

mohaps



#include <stdio.h>



int GETCH(void)
{
	return _getch();
}

int main(void)
{
char input;
char *ptr;
char password[20];
int count;

count = 0;

printf("enter your password: ");

do
{

input = GETCH();
if(input == '\xD') break; // enter pressed?
putc('*', stdout);
ptr = &input;
password[count] = *ptr;
count++;

}while(count < 20);

password[count++] = '\0'; // terminate the string 

printf("\nyour password: %s\n", password);

return 0;
}

comment:2 by david_abrahams, 19 years ago

Status: assignedclosed
Logged In: YES 
user_id=52572

This is not an appropriate request for Boost.

by anonymous, 15 years ago

Attachment: password.doc added
Note: See TracTickets for help on using tickets.