|
Need Linux Help:Problem with disabling echo
Ok linux programmers I need some help. I am writing a simple client - server program that lhas the client connecting to the server via username and password. When entering the password I want to disable echo so the password is not displayed on the screen. I have it working so that the password isnt displayed but when I exit out of my program all the prompts and everything else is just a mess of scrambled sybols causing me to have to go to a new terminal each time, because I cant really do anything on the current terminal in its state.
This is what my code looks like
static struct termios Otty,Ntty
tcgettattr(0,&Otty);
Ntty = Otty;
Ntty.c_lflag &= ~ECHO;
tcsetattr(0,TCSANOW,&Ntty);
/*read input in yadda yadda yadda*/
tcsetattr(0,TCSANOW,&Otty);
It works except upon exiting everyting is jarbled. Any Suggestions?
|