Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site genrad.UUCP Path: utzoo!linus!security!genrad!john From: john@genrad.UUCP (John Nelson) Newsgroups: net.lang.c Subject: Re: 1-char input in C Message-ID: <3755@genrad.UUCP> Date: Thu, 22-Dec-83 16:55:41 EST Article-I.D.: genrad.3755 Posted: Thu Dec 22 16:55:41 1983 Date-Received: Fri, 23-Dec-83 01:06:41 EST References: <463@ihuxn.UUCP> Organization: GenRad, Bolton, Mass. Lines: 15 Your problem is a common one. The problem is that UNIX is buffering up the data, as opposed to the C library routines. The most portable solution (and easiest to understand) is to use the system() call to change the tty mode as follows: #include main() { system("stty raw"); /* dont buffer data */ getchar(); system("stty -raw"); /* restore normal buffering */ } The other option is to use ioctl() (or gtty & stty on systems that have it) to set the tty modes properly. The problem with this is that BELL, BSD and V7 systems are all different in the exact format of these ioctl()'s