Opened 17 years ago

Closed 16 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:


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 11 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 16 years ago by mohaps

Logged In: YES 

 this code works on windows 


#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: ");


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

}while(count < 20);

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

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

return 0;

comment:2 Changed 16 years ago by david_abrahams

Status: assignedclosed
Logged In: YES 

This is not an appropriate request for Boost.

Changed 11 years ago by anonymous

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