delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/10/28/06:23:50

Date: Thu, 28 Oct 1993 11:08:37 +0100
To: djgpp AT sun DOT soe DOT clarkson DOT edu
From: ahelm AT email DOT tuwien DOT ac DOT at (Dipl.-Ing. Anton Helm)
Subject: Re: getch without echo?

When using getkey() you might have the problem, that the keyboard buffer is
not empty. So you get characters you entered an hour ago...

use:

#include <pc.h>

while(kbhit())
  getkey();

to clear the buffer BEFORE you read characters from the keyboard with getkey().



Tony




=============================================================================
                                  **
Institut fuer Nachrichtentechnik  **    Dipl.-Ing.
und Hochfrequenztechnik           **    Anton HELM
Guszhausstr. 25/389               **    Gratian-Marx Str. 7/27
A-1040 Wien                       **    A-1110 Wien
AUSTRIA                           **    AUSTRIA  
                                  **
Tel.: +43-1-58801-3524            **
FAX : +43-1-5870583               **
                                  **
=============================================================================
   ________   __    __           __        __   __   _______   __        __
  /__   __/  / /   / /          / /       / /  / /  / _____/  /  \      / /
    /  /    / /   / /  _____   / /  __   / /  / /  / /____   / /\ \    / /
   /  /    / /   / /  /____/  / /  / /  / /  / /  / _____/  / /  \ \  / /
  /  /    / /___/ /          / /__/ /__/ /  / /  / /____   / /    \ \/ /
 /__/    /_______/          /___________/  /_/  /______/  /_/      \__/

============================================================================
=



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019