www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/09/09:45:54

From: loki AT nectar DOT com DOT au-remove (loki)
Newsgroups: comp.os.msdos.djgpp
Subject: problems reading from keyboard
Message-ID: <slrn6vd10f.4b.loki@anima.nectar.com.au>
Organization: Nectar Online Services
Lines: 25
Date: 9 Sep 98 13:38:35 GMT
NNTP-Posting-Host: 203.18.79.30
NNTP-Posting-Date: Wed, 09 Sep 1998 23:42:19 EST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hey all,

  I seem to be having problems reading keys from the keyboard.  This is
probably a really dumb question because I've missed something obvious, so
bear with me.  Here's a snippet of code which shows my problem:

int c;

while (c=getkey() != 'q') {
	printf("%d\n",c); fflush(stdout);
}

  Now, the strange thing is that all this prints out is 1's; in other words,
I'm reading ASCII character 1 no matter what I press... yet pressing the Q
key exits the program just fine.  What am I doing wrong or what am I
forgetting?



-- 
       loki
loki (at) nectar.com.au         http://puck.nether.net/~loki/
# Dare I disturb the universe?  You bet I do!

- Raw text -


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