delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/08/14:05:55

Message-ID: <366D767C.F0A9FB29@nccoast.net>
Date: Tue, 08 Dec 1998 13:57:00 -0500
From: Phillip Rhodes <mindcrime AT nccoast DOT net>
Organization: Wilmington Star News
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: C++ Question (slightly off topic)
References: <Pine DOT GSO DOT 3 DOT 96 DOT 981207190045 DOT 3497A-100000 AT expert DOT cc DOT purdue DOT edu>
Reply-To: djgpp AT delorie DOT com


Nathaniel Johnson wrote:

> 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
>  }

> }

Thanks, but I'm trying to do it in C++, using the C++ Iostream library.  I
want to avoid the old C style io routines.   What you showed above though,
is exactly the effect I want, I just need a way to do it in C++, using
iostreams.

TTYL,
Phil

- Raw text -


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