🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Summary: How to flush keyboard buffer

#939
From: Denis Beauregard
Date: Mon, 17 Aug 1992 18:30
28 lines
1846 bytes
One comment I have regarding this trend.

What happens if you depress ctrl-break and your program is enough over
DOS not to stop at that moment (i.e. if you disabled ctrl-break by
something like signal() or other mean).

In one case (kbhit?), the value returned is either 0 or the character
received.  But ctrl-break is also returning a value of 0!
In other words, the program will freeze or exit if you typed ctrl-break!

My work-around consisted in writing my own kbhit function in Assembler.
I called it keyin().

Instead of returning the character received, it tests the zero flag and
return a response accordingly (0 or 1 for instance).  I think both
bioskey(1) and kbhit return the input character, so this must be
checked.  Also, this particular behaviour (I consider this as a bug)
was found in Zortech compiler.  No idea if Borland, Microsoft or
other will do the same.

One last word : if you know how to process ctrl-break, you probably
already have a work-around or set the BREAK switch so it does not harm.

-- 
  \_\    Denis Beauregard  *  internet:beaurega@ireq.hydro.qc.ca
 /   \   Genealogiste officiel : Beauregard/Jarret/Jarest/Vincent
J   __>  Barthelemy Jarret (1471) -> Andre Jarret, sieur de Beauregard (1665)
\_.-===   -> Denis Beauregard (1992)                  Opinions ? Et pis non !
Technical Details
Message-ID: <Bt54q3.8oJ@ireq.hydro.qc.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!rpi!utcsri!bonnie.concordia.ca!hobbit.ireq.hydro.qc.ca!beaurega
References: <1992Aug14.014304.27238@news.ysu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!rpi!utcsri!bonnie.concordia.ca!hobbit.ireq.hydro.qc.ca!beaurega
From: beaurega@ireq.hydro.qc.ca (Denis Beauregard)
Newsgroups: comp.os.msdos.programmer
Subject: Re: Summary: How to flush keyboard buffer
Message-ID: <Bt54q3.8oJ@ireq.hydro.qc.ca>
Date: 17 Aug 92 18:30:03 GMT
References: <1992Aug14.014304.27238@news.ysu.edu>
Sender: news@ireq.hydro.qc.ca (Netnews Admin)
Organization: Institut de recherche d'Hydro-Quebec, Varennes, Canada
Lines: 28