Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!motcsd!hpda!hpcupt1!vandys From: vandys@hpcupt1.HP.COM (Andrew Valencia(Seattle)) Newsgroups: comp.unix.wizards Subject: Re: terminal i/o Message-ID: <-286359998@hpcupt1.HP.COM> Date: 14 Jun 89 15:02:48 GMT References: <3836@sdsu.UUCP> Organization: Hewlett Packard, Cupertino Lines: 25 / hpcupt1:comp.unix.wizards / mmcp@sdsu.UUCP ( mmcp) / 8:48 pm Jun 12, 1989 / > ... > ioctl( fd, TCFLSH, 0 ); /* flush input buffer */ > c = getc( stdin ); /* stdin and fd both > ...more stuff > > Is this enough to do what I want? ... >Remember, I am trying to erase the characters from the input buffer. I don't >want any characters there until I actually post a read. It's close. TCFLSH results in all the buffered characters in both the line discipline and the device driver being thrown away. There are two windows of opportunity which are left: some data might be inbound to the card when you make the request; this data might not be thrown away. Also, a character can arrive between the time you do the ioctl() and the time you post the read. In your code example, this window appears very small, but it DOES exist. Regards, Andy Valencia ...!hplabs!hpisoa1!vandys Caveat: My statments result from a two-minute look at the code. Also, they're just my personal attempt at helping you. None of this has anything to do with HP!