Page 1 of 1

Flush keyboard buffer

Posted: Wed Jul 24, 2024 3:09 pm
by Andrew
How can I flush the keyoard buffer?
The Superbasic Manual says:
When KEYROW is used, any characters in the type-ahead buffer are cleared, therefore, if you wish to avoid accidental input by the user of unwanted keys, you could use:

dummy = KEYROW(0): Quit$ = INKEY$(-1)
But this is not working for me in QPC or sQLux

Re: Flush keyboard buffer

Posted: Wed Jul 24, 2024 3:23 pm
by dilwyn
Could the FLUSH #channel keyword (TK2) be used. Can't remember if it is procedure or function. Possibly can only be used on file channels, not sure.

Re: Flush keyboard buffer

Posted: Wed Jul 24, 2024 4:02 pm
by Andrew
dilwyn wrote: Wed Jul 24, 2024 3:23 pm Could the FLUSH #channel keyword (TK2) be used. Can't remember if it is procedure or function. Possibly can only be used on file channels, not sure.
It can be used only on file channels.

Re: Flush keyboard buffer

Posted: Wed Jul 24, 2024 6:00 pm
by tofro
Andrew wrote: Wed Jul 24, 2024 4:02 pm
dilwyn wrote: Wed Jul 24, 2024 3:23 pm Could the FLUSH #channel keyword (TK2) be used. Can't remember if it is procedure or function. Possibly can only be used on file channels, not sure.
It can be used only on file channels.
What's wrong with

Code: Select all

REPEAT key : IF INKEY$="" : EXIT key

Re: Flush keyboard buffer

Posted: Wed Jul 24, 2024 6:50 pm
by Andrew
tofro wrote: Wed Jul 24, 2024 6:00 pm

Code: Select all

REPEAT key : IF INKEY$="" : EXIT key
That's what I did in the end! :D