Hi,
I'm using getchar() in qt-creator4 on linux-platform.Its going to an infinte loop,im not even able to enter the character,the system hangs so i force quit.Could someone please help me,how i can use getchar() in qt-creator4 on linux ?
sample code:
Qt Code:
#include <iostream> #include <stdio.h> int main() { char ch; printf( "Enter a character : "); ch=getchar(); printf("Char is %c \n",ch); return 0; }To copy to clipboard, switch view to plain text mode
Actually i'm supposed to use getch(),but since getch() is not available in linux.I had to use getchar(). It would great ,if anyone could suggest me how i
can use getch() in linux ? Along with the solution to the above problem.
Thanks,
Keerthi


Reply With Quote


Bookmarks