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().