[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
    Procedure KeyBuffer(Option:KeyBufferFunction);

    You may pass this procedure one of three values:

    Clear
    Save
    Restore

    By clearing  the  key  buffer,  all  keystrokes  in  the  buffer  are
    removed.

    Example

    WriteLn('Press a key to Format your Hard Disk.');
    KeyBuffer(Clear);
    C:=ReadKey;

    Requesting a save saves the  current  buffer  head and tail pointers.
    This is useful if you want to  read  a  key, check the character, and
    then either call a  procedure  depending  on  the  character pressed.
    But if the procedure to be  called  requires  the key press, it can't
    get it because it's already been read  from the buffer.  So by saving
    the buffer pointers, getting the key and then restoring the pointers,
    the old key 'reappears' in the buffer.

    The Save and  Restore  must  follow  each  other  quickly  before the
    user types data in at the keyboard and overwrites the buffer.

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson