Hi Everyone,
I know conio.h is not available in Unix. I want to use getch(). Using curses.h needs causes the screen to clear which I don't want.
I found a code snippet (source : internet) using termios, it works, the thing is I need to press enter/or any other key thrice...
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
int mygetch ( void )
{
int ch;
struct termios oldt, newt;
tcgetattr ( STDIN_FILENO, &oldt );
newt = oldt;
newt.c_lflag &= ~( ICANON | ECHO );
tcsetattr ( STDIN_FILENO, TCSANOW, &newt );
ch = getchar();
tcsetattr ( STDIN_FILENO, TCSANOW, &oldt );
return ch;
}
Any help on this would be of great help...