http://forums.devshed.com/c-programming-42/ioctl-and-termios-for-canonical-read-60821.html main(){
struct termios oldT, newT; char c; ioctl(0,TCGETS,&oldT); /*get current mode newT=oldT; newT.c_lflag &= ~ECHO; /* echo off */ newT.c_lflag &= ~ICANON; /*one char @ a time*/ ioctl(0,TCSETS,&newT); /* set new terminal mode */ read(0,&c,1); /*read 1 char @ a time from stdin*/ ioctl(0,TCSETS,&oldT); /* restore previous terminal mode */ } |