Path: utzoo!mnetor!uunet!husc6!husc4!cherry From: cherry@husc4.HARVARD.EDU (michael cherry) Newsgroups: comp.sys.amiga Subject: Re: Need help reading single character from keyboard without waiting Message-ID: <3937@husc6.harvard.edu> Date: 29 Jan 88 01:15:29 GMT References: <273@altera.UUCP> Sender: news@husc6.harvard.edu Reply-To: cherry@husc4.UUCP (J. Michael Cherry) Organization: Dept. Molecular Biology, Mass. General Hospital, Boston Lines: 26 Keywords: need simple no-wait unbuffered keyboard input method This is what I use. ---- #include #include main() { struct sgttyb stty; struct sgttyb ostty; char c; /* put the console in RAW mode */ ioctl(0, TIOCGETP,&stty); ostty = stty; stty.sg_flags |= RAW; ioctl(0,TIOCSETP,&stty); while(1) { c = getchar(); /* read a character. Will get each character as they are typed */ /* do something with the character */ } /* return the console to its original state */ ioctl(0,TIOCSETP,&ostty); }