From owner-freebsd-hackers Thu May 23 15:47:13 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from 0lsen.net (12-224-41-96.client.attbi.com [12.224.41.96]) by hub.freebsd.org (Postfix) with ESMTP id 8E1A237B401 for ; Thu, 23 May 2002 15:47:10 -0700 (PDT) Received: by 0lsen.net (Postfix, from userid 1001) id 3DFDF55B; Thu, 23 May 2002 15:47:09 -0700 (PDT) Date: Thu, 23 May 2002 15:47:09 -0700 From: Clint Olsen To: echo dev Cc: hackers@freebsd.org Subject: Re: your mail Message-ID: <20020523224709.GA77003@0lsen.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.27i Organization: NULlsen Network X-Disclaimer: Mutt Bites! Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On May 23, echo dev wrote: > is there anyone that might know why the fflush did not work???? I fugre > this works besuse it shoves an empty vale into the buffer thus casuseing > it to be empty..... From the C-FAQ - http://www.eskimo.com/~scs/C-faq/top.html 12.26: How can I flush pending input so that a user's typeahead isn't read at the next prompt? Will fflush(stdin) work? A: fflush() is defined only for output streams. Since its definition of "flush" is to complete the writing of buffered characters (not to discard them), discarding unread input would not be an analogous meaning for fflush on input streams. There is no standard way to discard unread characters from a stdio input stream, nor would such a way necessarily be sufficient, since unread characters can also accumulate in other, OS-level input buffers. You may be able to read and discard characters until \n, or use the curses flushinp() function, or use some system-specific technique. See also questions 19.1 and 19.2. References: ISO Sec. 7.9.5.2; H&S Sec. 15.2. -Clint To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message