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

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

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.