keethi2
8th September 2011, 21:55
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:
#include <iostream>
#include <stdio.h>
int main()
{
char ch;
printf( "Enter a character : ");
ch=getchar();
printf("Char is %c \n",ch);
return 0;
}
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
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:
#include <iostream>
#include <stdio.h>
int main()
{
char ch;
printf( "Enter a character : ");
ch=getchar();
printf("Char is %c \n",ch);
return 0;
}
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