🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8156

Re: clear keyboard buffer

#8156
From: Alan Bellingham
Date: Fri, 19 Nov 2004 15:54
23 lines
1563 bytes
"Marco" <mliorni@NoMail.com> wrote:

>  I use "fflush(stdin)" to clear keyboard buffer and the
>function return zero (result is OK).

Don't rely on that, though. fflush() writes pending _output_. Using it
on an input stream has no documented effect.

When it does work, it's a non-standard extension.

>  I'd like to know :
>  Is there another function to clear keyboard buffer
>  in GUI application?

GUI applications don't really have keyboard input buffers in the same
way. However, you can use PeekMessage on the window message queue,
looping till it returns 0.

See the API help for PeekMessage.

Alan Bellingham
-- 
ACCU Conference 2005 - 20-23 April, Randolph Hotel, Oxford, UK
Technical Details
Message-ID: <rh5sp0p22n33t4unoajr6neojn8km5scr8@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <419e0b48$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,30158ecfeb998ca0
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Alan Bellingham <alanb@episys.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: clear keyboard buffer
Date: Fri, 19 Nov 2004 15:54:44 +0000
Reply-To: alanb@episys.com
Message-ID: <rh5sp0p22n33t4unoajr6neojn8km5scr8@4ax.com>
References: <419e0b48$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 193.129.251.130
X-Trace: newsgroups.borland.com 1100879683 193.129.251.130 (19 Nov 2004 07:54:43 -0700)
Lines: 23
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail