Modify

Opened 16 years ago

Closed 15 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 10 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 15 years ago by mohaps

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 Changed 15 years ago by david_abrahams

Status: assignedclosed
Logged In: YES 
user_id=52572

This is not an appropriate request for Boost.

Changed 10 years ago by anonymous

Attachment: password.doc added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as deleted The owner will remain nobody.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.