0

This is a simple password implementation.

void getPassword()
{
     int i = 0, flag = 0 ;
     char c ;

     char password[100] ;

     cout<<"\n Enter Password : " ;

     while(1)
     {
        c = getch() ;

        if(c! = 13 && c! = 8)
        {
         cout<<"*" ;

         Password[i] = c ;

         i++ ;
        }

        else if(c == 8 && i)
        {
           Password[--i] = '\0' ;

           cout<<"\b \b" ;
        }

        if(c == 13)
        {
         Password[i] = '\0' ;

         break ;
        }

      }


}

Here I'm using getch() method and conio.h for accepting a key board hit without echo-ing it.
My question is, what is its replacement in other compilers, especially in Linux OS ?

I saw ncurses library but couldn't find any method that works like getch().

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by iamthwee
0

With 10 pages of posts here on DaniWeb alone, I'm sure you can find the answer using SEARCH.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.