delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/03/01:45:21

From: Damian Yerrick <Bullcr_pd_yerrick AT hotmail DOT comRemoveBullcr_p>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: code of up and down arrow ...
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <2q2hosg9aamam1od8doca4uu7hh6velbqu@4ax.com>
References: <8ma1hl$rfm$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 33
X-Trace: /bV2//xUYCzbiytjV/RksfFOZRbajBlo45erpiRKOhjsqGjck8ArecG2yKi+V0Su/qN4LUZEnpcI!QFdN331ke7P8mrJwPgZZvWVohHNBE2y2SnW4Ztz7VJGJ2R8KTRm5YW/LW1A3JM0+/bVvV/bFyZfJ!jbGn
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Wed, 02 Aug 2000 21:00:33 GMT
Distribution: world
Date: Wed, 02 Aug 2000 21:00:33 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Wed, 2 Aug 2000 22:50:58 +0200, "Florent"
<florent AT oih DOT rwth-aachen DOT de> wrote:

>Hi,
>I'm looking for the way to detect that a user hit the keys up and down
>(arrows)

Call kbhit() to see if the user has pressed a key.  Then call getch()
to get the ASCII code of the key.  If you get 0, you have an extended
key such as an arrow or an Fkey; call getch() to get the scancode.
The usual DOS C idiom for this:

int GetKey()
{
  int k = getch();
  if(k == 0)
    return getch() << 8;
  else return k;
}

>I can use getch but the fact that the value is 0+value to determine which
>key is pressed and it didn't work so well ...

Works For Me.  Look in the recent archives for discussion on this
topic.

-- 
Damian Yerrick
"I refuse to listen to those who refuse to listen to reason."
See the whole sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your signature to
prevent the spread of signature viruses.  http://www.mcafee.com/

- Raw text -


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