Article Q58213
◄Contents► ◄Index► ◄Back►
─────────────────────────────────────────────────────────────────────────────
◄Knowledge Base Contents► ◄Knowledge Base Index►
How to Empty (Flush) File And Keyboard Buffers in Basic - Q58213
The three sample programs included below demonstrate how to flush
a keyboard buffer and file buffer. The first two programs listed
below show two different methods of emptying the keyboard input
buffer. The first program uses a MS-DOS interrupt to clear the
buffer, while the second program uses the INKEY$ function. The third
code example listed below shows two different methods of flushing a
file buffer to disk.
The following program uses MS-DOS Interrupt 21h (33 decimal) with
function 0Ch (12 decimal), which flushes the input (type-ahead)
keyboard buffer. To run this program inside the Visual Basic
version 1.0 for MS-DOS (VBDOS.EXE) environment, you must load the
Quick library VBDOS.QLB with the /L option.
◄See Program 1►
The following program uses the INKEY$ function to read characters from
the keyboard buffer until no more are available:
◄See Program 2►
Flushing a file buffer to disk from within a Visual Basic version 1.0
for MS-DOS program can be done with one of the following two methods
using MS-DOS Interrupt CALLs:
◄See Program 3►