🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #327

Re: How to flush keyboard buffer?

#327
From: Stan Brown
Date: Sat, 08 Aug 1992 23:38
16 lines
1148 bytes
In article <3721@keele.keele.ac.uk> coa44@seq1.keele.ac.uk (Mark Scase) writes:
>I'm programming in MSDOS with Borland C.  How do you flush the
>internal keyboard buffer?

A follow-up to this recommended "fflush(stdin)".  IMHO, this is not the
best solution. The BC++ 2.0 library manual says what happens with an
output stream but is silent on the effect of fflishing an input stream.

I'd suggest "while (kbhit()) getch();" provided your program will be
running under DOS not Windows.

-- 
Stan Brown, Oak Road Systems                      brown@Ncoast.ORG

"Ingrate, n.  One who receives a benefit from another, or is otherwise
an object of charity."                          --Ambrose Bierce
Technical Details
Message-ID: <1992Aug08.233815.4294@NCoast.ORG>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ncoast!brown
References: <3721@keele.keele.ac.uk>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ncoast!brown
From: brown@NCoast.ORG (Stan Brown)
Subject: Re: How to flush keyboard buffer?
Organization: Oak Road Systems, Cleveland Ohio USA
Date: Sat, 08 Aug 1992 23:38:15 GMT
Message-ID: <1992Aug08.233815.4294@NCoast.ORG>
Keywords: DOS, keyboard buffer
References: <3721@keele.keele.ac.uk>
Lines: 16