I had installed ncurses
library in Linux mint and still I can't use getch
function in c. I am using Linux mint 18.2.
Here is my program:
#include <stdio.h>
#include <curses.h>
int main() {
char k;
printf("how are you");
k = getch();
printf("%c",k);
}
and here is the output:
ram@ram$ gcc-7 test.c -lcurses
ram@ram$ ./a.out
how are you�ram@ram$
It does't wait for me to press any key and terminate to quickly. I don't want to install conio.h
for Linux. How can I use getch
and getche
function in Linux? Please don't tell me to make my own function. I am still a noob. Or there must be alternatives.