#include<unistd.h>
#include<termios.h>
char getch()
{
char buf=0;
struct termios old={0};
fflush(stdout);
if(tcgetattr(0, &old)<0)
perror("tcsetattr()");
old.c_lflag&=~ICANON;
old.c_lflag&=~ECHO;
old.c_cc[VMIN]=1;
old.c_cc[VTIME]=0;
if(tcsetattr(0, TCSANOW, &old)<0)
perror("tcsetattr ICANON");
if(read(0,&buf,1)<0)
perror("read()");
old.c_lflag|=ICANON;
old.c_lflag|=ECHO;
if(tcsetattr(0, TCSADRAIN, &old)<0)
perror ("tcsetattr ~ICANON");
return buf;
}
Wklej to przed maina i będziesz mógł uzywać getch() jak w windowsie
https://stackoverflow.com/questions/7469139/what-is-equivalent-to-getch-getche-in-linux
getch() jest jeszcze w bibliotece ncurses.h, nie wiem jakiej dystrybucji używasz, ale w mincie musiałem ją zainstalować ręcznie