Path: utzoo!attcan!utgpu!watmath!iuvax!mailrus!uflorida!unf7!ckurak
From: ckurak@unf7.UUCP (Charles Kurak)
Newsgroups: comp.lang.pascal
Subject: Re: Clearing the keyboard buffer
Message-ID: <228@unf7.UUCP>
Date: 3 Oct 89 12:33:01 GMT
References: <1169@krafla.rhi.hi.is>
Reply-To: ckurak@unf7.UUCP (Charles Kurak)
Organization: University of North Florida, Jacksonville
Lines: 22

In article <1169@krafla.rhi.hi.is> karlth@rhi.hi.is (Karl Thoroddsen) writes:
>While writing in TURBO 4.0 I've constantly encountered the problem
>of not being able to flush(clear) the keyboard buffer.
>
>Is there anyone out there who can help me?
>
>Thanks in advance
>
>Karl Thoroddsen
I've used the following:

procedure ClearTypeAhead;
var ch : char;
begin
  repeat
  if keypressed then
    ch := readkey;
  until not keypressed;
end;

Also, remember "Uses CRT" at the beginning of your code so keypressed will be
defined.