I’m new with QNX 6. I want to be able to read in a string of characters from the keyboard in IDE using the fgets() function, however, when I’m running the program in the IDE, the presence of the fgets() itself causes nothing to be outputted to the console view.
Example program:
#include <stdio.h> #include <stdlib.h>
#define MAXBUF 20
char buff[MAXBUF+1];
int main()
{
int ch;
printf("->");
fgets(buff,MAXBUF,stdin); //if this line is included, nothing shows up
ch=buff[0];
printf("You typed %c\n",ch);
return(0);
}
How can I read keyboard input in an IDE C Project?
You can do it, but you have to to a setvbuf() to turn off buffering as the IDE doesn’t attach you to a proper tty. This is in the release notes for the IDE.