In the next code:
#include
int main(void) {
int c;
while ((c=getchar())!= EOF)
putchar(c);
return 0;
}
I've had this problem/question come up in an assignment that I'm currently working on. It also depends on which input you are grabbing from. I am using
/dev/tty
to get input while the program is running, so that needs to be the filestream associated with the command.
On the ubuntu machine I have to test/target, it required more than just
system( "stty -raw" );
or
system( "stty -icanon" );
I had to add the --file flag, as well as path to the command, like so:
system( "/bin/stty --file=/dev/tty -icanon" );
Everything is copacetic now.