delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/09/06/15:30:27

From: "MrShifty" <mailmespamhere AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: simple getch()
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
Message-ID: <wa7e9.146658$Rx4.1541323@twister.tampabay.rr.com>
Date: Fri, 06 Sep 2002 19:16:44 GMT
NNTP-Posting-Host: 65.34.64.147
X-Complaints-To: abuse AT rr DOT com
X-Trace: twister.tampabay.rr.com 1031339804 65.34.64.147 (Fri, 06 Sep 2002 15:16:44 EDT)
NNTP-Posting-Date: Fri, 06 Sep 2002 15:16:44 EDT
Organization: RoadRunner - Tampa Bay
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

When I run this program it doesn't beep until I hit escape. At that point it
beeps however many times that I hit the spacebar. I know it has to be
somehting simple. Any help is appreciated. If this is the wrong newsgroup
please point in the direction of a Windows specific newsgoup.

Here is the code:

#include <iostream.h>
#include <conio.h>

int main(){
 int ch;

 while(ch != 27){
  ch = getch();
  if(ch == 32)
   cout << '\a';
 }

 return 0;
}


- Raw text -


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