1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-09-07 22:20:15 +00:00
QB64-PE/source/subs_functions/extensions/Luke Stuff-ID_Includes.bas
Luke Ceddia 801ae6ae60 Added a _KEYCLEAR [buffer&] command to clear any characters in input buffers.
Without a parameter, it clears all buffers. A numeric parameter will
clear only a specific buffer: 1 = INKEY$ buffer (and other traditional
QB input commands), 2 = _KEYHIT buffer, 3 = INP(&H60) buffer. The last
one is not actually cleared, but we pretend we've read all the data from
it.

To ensure no stray characters, use this command immediately before the
code you wish to sanitise. You never know when the user might bang on
the keyboard, and this also helps to avoid stray key release values
persisting in the _KEYHIT buffer.
2014-09-27 03:12:54 +10:00

17 lines
No EOL
301 B
QBasic

'Get Current Working Directory
clearid
id.n = "_CWD"
id.musthave = "$"
id.subfunc = 1
id.callname = "func__cwd"
id.ret = STRINGTYPE - ISPOINTER
regid
clearid
id.n = "_KEYCLEAR"
id.subfunc = 2
id.args = 1
id.arg = MKL$(LONGTYPE - ISPOINTER)
id.specialformat = "[?]"
id.callname = "sub__keyclear"
regid