TURBO PASCAL

Новости

Программы   

Turbo Pascal 

Игры

Документация   

Странности

FAQ

Ссылки

Форум

Гостевая книга

Рассылка

Благодарности

Об авторе

 16: How can I clear the keyboard type-ahead buffer?

 A: Three methods are 
usually suggested for solving this problem.
a) The first is to use something like
     uses Crt;
     while KeyPressed do ReadKey;
This kludge-type method has the disadvantage of requiring the Crt
unit. Also, in connection with procedures relying on ReadKey for
input, it may cause havoc on the programs logic.
b) The second method accesses directly the circular keyboard 
buffer
     var head : word absolute $0040:$001A;
         tail : word absolute $0040:$001C;
     procedure FLUSHKB; begin head := tail; end;
For a slightly different formulation of the same method see Michael
Tischer (1992), PC Intern System Programming, p. 462.
c) The third method is to call interrupt 21Hex (the MS-DOS
interrupt) with the ax register set as $0C00. This method has the
advantage of not being "hard-coded" like the second 
method, and thus
should be less prone to incompatibility.
 

 Contents

На первую страницу

Rambler's Top100 Rambler's Top100
PROext: Top 1000

(с)Все права защищены

По всем интересующим вопросам прошу писать на электронный адрес

Hosted by uCoz