Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cwjcc!gatech!hubcap!ncrcae!ncrlnk!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: 4.3 curses - how to discard "premature" input? Message-ID: <1047@auspex.UUCP> Date: 18 Feb 89 19:05:29 GMT References: <15336@oberon.USC.EDU> <697@sactoh0.UUCP> Reply-To: guy@auspex.UUCP (Guy Harris) Distribution: usa Organization: Auspex Systems, Santa Clara Lines: 22 > Have you tried flushing the input buffer? Under MSDOS, it would be >something like fflush(stdin); to remove unwanted characters in the >input buffer. Unfortunately, he's doing that stuff under UNIX, not MS-DOS, and: 1) "fflush" on an input stream, on some UNIX C implementations, doesn't do a damn thing; the May 13, 1988 dpANS indicates that the action of "fflush" on something other than "an output stream or an update stream in which the most recent operation was output" is undefined. (It appears to do what you want in the S5R3 implementation - it throws away the stuff in the input buffer. It does the same in the SunOS 4.0 implementation. It does not, however, do so in the 4.3BSD implementation.) 2) Tere's more than one input buffer that he'd want to flush. There's the one maintained by standard I/O; there's also the one maintained by the terminal driver software, and flushing the latter one requires that you perform an "ioctl" function specific to terminals. The standard I/O library doesn't perform that function.