Clearing the keyboard buffer 
Author Message
 Clearing the keyboard buffer

 Sorry guys, I know this has been posted before, but how do you clear
the keyboard buffers in quickbasic 4.xx ?

thanks in advance.    



Wed, 31 Dec 1997 03:00:00 GMT  
 Clearing the keyboard buffer

' Sorry guys, I know this has been posted before, but how do you clear
'the keyboard buffers in quickbasic 4.xx ?

DO: LOOP UNTIL INKEY$ = ""

--
"...AND WITH DUST IN THROAT I CRAVE, ONLY KNOWLEDGE WILL I SAVE,
TO THE GAME YOU STAY A SLAVE... - ROVER                  WANDERER
                                  NOMAD                  VAGABOND
                                - CALL ME WHAT YOU WILL." (Hetfield/Ulrich)



Wed, 31 Dec 1997 03:00:00 GMT  
 Clearing the keyboard buffer

Quote:

>  Sorry guys, I know this has been posted before, but how do you clear
> the keyboard buffers in quickbasic 4.xx ?

DO: LOOP WHILE LEN(INKEY$)

You could also use:

DO: LOOP UNTIL INKEY$ = ""

...but checking for a zero string length is faster than comparing
the returned string to a null string.

---
Glen Blankenship



Wed, 31 Dec 1997 03:00:00 GMT  
 Clearing the keyboard buffer

Quote:
> Sorry guys, I know this has been posted before, but how do you clear
>the keyboard buffers in quickbasic 4.xx ?
>thanks in advance.

Basic indepentant code :

for a%=0 to 16
  dummy$=inkey$  
next a%
dummy$=""

This will clear anything that is in the buffer.

regards
vincent

regards

Vincent
--------------------------------------------------------------
Vincent Himpe
                                                 /////
Internet :                                       O  *)


http://www.ping.be/~ping0751
--------------------------------------------------------------



Thu, 08 Jan 1998 03:00:00 GMT  
 Clearing the keyboard buffer

Quote:

> Basic indepentant code :

> for a%=0 to 16
>   dummy$=inkey$  
> next a%
> dummy$=""
> This will clear anything that is in the buffer.

Wouldn't this be easier:
WHILE INKEY$ <> "": WEND

Colin.,

--
The teacher stands in front of the class, the lesson plan he can't recall,
The students eyes don't perceive the lies bouncing off every {*filter*}ing wall.
His composure is well kept, I guess he fears playing the fool,
The complacent student sits and listens to the bullshit that he learned in
school.                                 -  Rage Against The Machine



Thu, 08 Jan 1998 03:00:00 GMT  
 Clearing the keyboard buffer

Quote:


> > Basic indepentant code :

> > for a%=0 to 16
> >   dummy$=inkey$  
> > next a%
> > dummy$=""
> > This will clear anything that is in the buffer.
> Wouldn't this be easier:
> WHILE INKEY$ <> "": WEND

Yes, not to mention faster (if the buffer's only got one key in it, why
check it 16 times?) and more reliable (some people have kb buffers that
hold more than 16 keys).

You could even speed that up by using:

WHILE LEN(INKEY$): WEND

...since checking for a zero-length string is almost always faster than
doing a string comparison.

---
Glen Blankenship



Thu, 08 Jan 1998 03:00:00 GMT  
 Clearing the keyboard buffer

Quote:


>> Sorry guys, I know this has been posted before, but how do you clear
>>the keyboard buffers in quickbasic 4.xx ?
>>thanks in advance.
>Basic indepentant code :
>for a%=0 to 16
>  dummy$=inkey$  
>next a%
>dummy$=""

Or

Do
Loop Until Inkey$ = ""

--
                 _  
James Eibisch  ('v')       N : E : T : A : D : E : L : I : C : A
Reading, U.K.  (,_,)       http://metro.turnpike.net/J/jeibisch/
              =======



Thu, 08 Jan 1998 03:00:00 GMT  
 Clearing the keyboard buffer



   >> > Basic indepentant code :
   >> >
   >> > for a%=0 to 16
   >> >   dummy$=inkey$
   >> > next a%
   >> > dummy$=""
   >> > This will clear anything that is in the buffer.
   >> Wouldn't this be easier:
   >> WHILE INKEY$ <> "": WEND
   >Yes, not to mention faster (if the buffer's only got one key in it, why
   >check it 16 times?) and more reliable (some people have kb buffers that
   >hold more than 16 keys).
   >You could even speed that up by using:
   >WHILE LEN(INKEY$): WEND
   >....since checking for a zero-length string is almost always faster than
   >doing a string comparison.

Faster:

DEF SEG=0
   POKE 1050, PEEK(1052)
DEF SEG

'Uncle Dave'

A bachelor never makes the same mistake once.



Sat, 10 Jan 1998 03:00:00 GMT  
 Clearing the keyboard buffer

Quote:

> Faster:

> DEF SEG=0
>    POKE 1050, PEEK(1052)
> DEF SEG

This has a very slight bug potential, though:  If the user has installed
a keyboard buffer extender, the head and tail pointers may have non-zero
high bytes.  Many extenders create a 256-key (512 byte) buffer, so it's
possible that the high bytes of the two pointers won't be the same.

Setting the two low bytes equal to one another without checking the high
bytes could cause spurious keystokes to suddenly 'appear' in the buffer.

Attempting to peek and poke both bytes exposes you to the possibility of a
keystroke interrupt occuring while you're peeking and poking, which can
wreak havoc if it changes a pointer you're only half-finished with.

Neither of these things are extremely likely, certainly, but they
*are* possible.  The INKEY$ loop doesn't have this problem.

---
Glen Blankenship



Sun, 11 Jan 1998 03:00:00 GMT  
 Clearing the keyboard buffer
Subject: Clearing the keyboard buffer

D>Faster:

D>DEF SEG=0
D>   POKE 1050, PEEK(1052)
D>DEF SEG

This doesn't work with a number of keyboard buffer extenders.  A DO/LOOP
is compatible with all situations.

--Dave
---
 t QMPro 1.53 t VaporHelp - Verb; {call MicroSoft Tech Support}



Tue, 13 Jan 1998 03:00:00 GMT  
 Clearing the keyboard buffer


   >Subject: Re: Clearing the keyboard buffer

   >Organization: Church of the Holy Toy
   >X-Newsreader: TIN [version 1.2 PL1]

   >Date: Wed, 26 Jul 1995 01:52:53 GMT
   >Lines: 26


   >> Faster:
   >>
   >> DEF SEG=0
   >>    POKE 1050, PEEK(1052)
   >> DEF SEG
   >This has a very slight bug potential, though:  If the user has installed
   >a keyboard buffer extender, the head and tail pointers may have non-zero
   >high bytes.  Many extenders create a 256-key (512 byte) buffer, so it's
   >possible that the high bytes of the two pointers won't be the same.
   >Setting the two low bytes equal to one another without checking the high
   >bytes could cause spurious keystokes to suddenly 'appear' in the buffer.
   >Attempting to peek and poke both bytes exposes you to the possibility
   >of a keystroke interrupt occuring while you're peeking and poking,
   >which can wreak havoc if it changes a pointer you're only
   >half-finished with.
   >Neither of these things are extremely likely, certainly, but they
   >*are* possible.  The INKEY$ loop doesn't have this problem.

Well reasoned, but the speed difference is enormous, if you are using
an older machine. Having suggested this, however, I think I will recode
the function in ASM and CLI before the move.

'Uncle Dave'                                                                                                                                

Don't question authority.  It doesn't know either.



Sat, 17 Jan 1998 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. HOW do I clear the Keyboard Buffer???

2. clearing the keyboard buffer

3. How do you clear the keyboard buffer?

4. Does Internet Explorer Clear the Keyboard Buffer?

5. how do I clear the keyboard buffer from the VB 5.0

6. How do I clear the keyboard buffer in vb 5.0

7. Mouse/keyboard buffer clear ...possible ?

8. Clear the keyboard type-ahead buffer in VB

9. Clear keyboard buffer?

10. How do I clear keyboard buffer in VB 5.0

11. How to clear keyboard buffer?

12. How to clear keyboard buffer ?

 

 
Powered by phpBB® Forum Software