Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Flushing non-read input data with using tcflush (was : fflush not flusing stdin!)

10 views
Skip to first unread message

Alex Vinokur

unread,
Mar 26, 2003, 11:34:32 AM3/26/03
to

"Alex Vinokur" <ale...@bigfoot.com> wrote in message news:b5q1jk$2c7kcc$1...@ID-79865.news.dfncis.de...
>
> "Shuo Xiang" <sxi...@student.math.uwaterloo.ca> wrote in message news:db3ae3ab.03032...@posting.google.com...
> > Greetings:
> >
> > While working on a computer science assignment I have had the need to
> > flush the contents of stdin. But the statement
> >
> > fflush(stdin);
> >
> > doesn't seem to be working. On the other hand:
> >
> > char s[80];
> >
> > gets(s);
> >
> > does seem to be working provided that whatever is in stdin is not
> > longer than 80 characters.
> >
> > Could anyone kindly point out why fflush failed in this situation.
> >
> > Regards,
> >
> > Shuo Xiang
>
> See tcflush (OS-dependent) :
> http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?tcflush+3
> http://www.opengroup.org/onlinepubs/007904975/functions/tcflush.html
> http://www.scit.wlv.ac.uk/cgi-bin/mansec?3C+tcflush
>
> See also "tcflush on SunOS and HP-UX" :
> http://groups.google.com/groups?selm=7vk28v%24u14%241%40nnrp1.deja.com
>

Also : usage sample on Windows 2000, DJGPP, gcc :
http://groups.google.com/groups?th=966b48614282dfce

=================================
Alex Vinokur
mailto:ale...@connect.to
http://www.simtel.net/pub/oth/19088.html
=================================


0 new messages