Think of typing a password. You type your password but what you see is merely a asterisk sign. If you use getch(), no problem! Put the problem is that I can't use the getch. See the code:

struct Func { 
    char password[9];
    char name[34];
    char code[8];
}element;

do{
    gotoxy(21,6);
    printf("****************************************");
    gotoxy(21,7);
    printf("**Password:                                          *******");
    gotoxy(21,8);
    printf("****************************************");
    gotoxy(46,7);
    cin>>element.password;  
}while(strlen(element.password)<4||strlen(element.password)>8);
fich.write((char *)&element,sizeof(Func));
fich.close();

Can some please tell how can i hide the password, in this case? :cry:

Recommended Answers

All 2 Replies

There is no way with cin>> because the input is buffered.

>the problem is that I can't use the getch.
Then you have to write a routine with equivalent functionality. There's no standard way to do what you want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.