delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/29/16:31:29

From: "Wim Cools" <w DOT cools AT chello DOT nl>
Newsgroups: comp.os.msdos.djgpp
References: <9jvmbi$1m3$1 AT news DOT hccnet DOT nl>
Subject: Re: arrowkeys keyboard
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <N8_87.292780$XL1.5156001@nlnews00.chello.com>
Date: Sun, 29 Jul 2001 20:14:37 GMT
NNTP-Posting-Host: 213.46.2.188
X-Complaints-To: abuse AT chello DOT nl
X-Trace: nlnews00.chello.com 996437677 213.46.2.188 (Sun, 29 Jul 2001 19:14:37 GMT)
NNTP-Posting-Date: Sun, 29 Jul 2001 19:14:37 GMT
Organization: chello broadband
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Kees Advokaat" <k DOT advokaat AT hccnet DOT nl> schreef in bericht
news:9jvmbi$1m3$1 AT news DOT hccnet DOT nl...
> Hallo,
>
> Can anybody tell me, what is the nature of the four arrowkeys of the
> qwerty keyboard?
> I mean, is there an ascii-value underneath that I can use in a char
> variable? What value?

Extended ASCII keys like the arrowkeys first return a '0' and then an ASCII
value.
For example, when you press the "UP"-arrow, the first getch() will return 0,
and doing another one will return an 'H'

int main()
{
        char c;
        c = getch();
        if (c == 0)
        {
                c = getch();
                if (c == 'H') printf("up!\n");
        } else printf(" %c\n", c);
        getch();
}

I'll put a little list here of the most common keys:
Key    Returns
home G
end    O
up      H
down  P
left K
right M
pageup I
pagedown Q
insert R
delete S
F1 ;
F2 <
F3 =
F4 >
F5 ?
F6 @
F7 A
F8 B
F9 C
F10 D

Hope this helps,
Wim.


- Raw text -


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