delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/07/19:02:17

Date: Mon, 7 Dec 1998 19:04:45 -0500 (EST)
From: Nathaniel Johnson <najohnso AT expert DOT cc DOT purdue DOT edu>
To: djgpp AT delorie DOT com
Subject: Re: C++ Question (slightly off topic)
In-Reply-To: <366B9CB8.2351B88E@nccoast.net>
Message-ID: <Pine.GSO.3.96.981207190045.3497A-100000@expert.cc.purdue.edu>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

if you just want to get a key when it is hit without using <ENTER> just
use this code

int c = 0;
while (c != 27) // until you hit <ESC>
{
  if (kbhit()) 
  {
    c = getch();
    printf("The key you hit is %d", c); // ex: if you hit A then c = 65
  }
.
.
.
}

- Raw text -


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