delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/03/26/11:45:42

From: "Alex Vinokur" <alexvn AT bigfoot DOT com>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Flushing non-read input data with using tcflush (was : fflush not flusing stdin!)
Date: Wed, 26 Mar 2003 18:34:32 +0200
Lines: 47
Message-ID: <b5skqr$2d7uag$1@ID-79865.news.dfncis.de>
References: <db3ae3ab DOT 0303250604 DOT 191c8926 AT posting DOT google DOT com> <b5q1jk$2c7kcc$1 AT ID-79865 DOT news DOT dfncis DOT de>
NNTP-Posting-Host: pop09-2ras2-p97.barak.net.il (212.150.105.97)
X-Trace: fu-berlin.de 1048696477 81000784 212.150.105.97 (16 [79865])
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Alex Vinokur" <alexvn AT bigfoot DOT com> wrote in message news:b5q1jk$2c7kcc$1 AT ID-79865 DOT news DOT dfncis DOT de...
>
> "Shuo Xiang" <sxiang AT student DOT math DOT uwaterloo DOT ca> wrote in message news:db3ae3ab DOT 0303250604 DOT 191c8926 AT posting DOT google DOT 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:alexvn AT connect DOT to
     http://www.simtel.net/pub/oth/19088.html
   =================================




- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019