www.delorie.com/djgpp/doc/libc/libc_375.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]



#include <pc.h>

const unsigned char * __get_extended_key_string(int xkey_code);


Returns an ECMA-48 compliant representation of an extended key's scan code in xkey_code.

See section getkey. See section getxkey.

Return Value

A string based on the extended key's scan code xkey_code:

Key Normal with Shift with Ctrl with Alt
Up Arrow ESC[A ESC[37~ ESC[59~
Down Arrow ESC[B ESC[38~ ESC[60~
Left Arrow ESC[C ESC[39~ ESC[61~
Right Arrow ESC[D ESC[40~ ESC[62~
Home ESC[1~ ESC[41~ ESC[63~
Insert ESC[2~ ESC[42~ ESC[64~
Delete ESC[3~ ESC[43~ ESC[65~
End ESC[4~ ESC[44~ ESC[66~
Page Up ESC[5~ ESC[45~ ESC[67~
Page Down ESC[6~ ESC[46~ ESC[68~
F1 ESC[[A ESC[25~ ESC[47~ ESC[69~
F2 ESC[[B ESC[26~ ESC[48~ ESC[70~
F3 ESC[[C ESC[27~ ESC[49~ ESC[71~
F4 ESC[[D ESC[28~ ESC[50~ ESC[72~
F5 ESC[[E ESC[29~ ESC[51~ ESC[73~
F6 ESC[17~ ESC[30~ ESC[52~ ESC[74~
F7 ESC[18~ ESC[31~ ESC[53~ ESC[75~
F8 ESC[19~ ESC[32~ ESC[54~ ESC[76~
F9 ESC[20~ ESC[33~ ESC[55~ ESC[77~
F10 ESC[21~ ESC[34~ ESC[56~ ESC[78~
F11 ESC[23~ ESC[35~ ESC[57~ ESC[79~
F12 ESC[24~ ESC[36~ ESC[58~ ESC[80~

Alt Key Alt Key
Alt-A ESC[81~ Alt-N ESC[94~
Alt-B ESC[82~ Alt-O ESC[95~
Alt-C ESC[83~ Alt-P ESC[96~
Alt-D ESC[84~ Alt-Q ESC[97~
Alt-E ESC[85~ Alt-R ESC[98~
Alt-F ESC[86~ Alt-S ESC[99~
Alt-G ESC[87~ Alt-T ESC[100~
Alt-H ESC[88~ Alt-U ESC[101~
Alt-I ESC[89~ Alt-V ESC[102~
Alt-J ESC[90~ Alt-W ESC[103~
Alt-K ESC[91~ Alt-X ESC[104~
Alt-L ESC[92~ Alt-Y ESC[105~
Alt-M ESC[93~ Alt-Z ESC[106~

NULL is returned if xkey_code has no translation.




#include <pc.h>
#include <stdio.h>

int key;

int main()
  key = getxkey();
  if (key < 0x100)
    putc(key, stdout);
    putc('\r', stdout);
    const unsigned char *str = __get_extended_key_string(key);
    if (str)

#include <pc.h>
#include <stdio.h>
#include <dpmi.h>

int main()
  __dpmi_regs r;
  const unsigned char *str;
  int is_extended_key;

  /* Wait for keypress. */
  r.h.ah = 0x11;
  __dpmi_int(0x16, &r);
  /* Print the encoding for function keys (F1, F2, etc.)
     and other extended keys (Home, End, etc.). */
  is_extended_key = (r.h.al == 0x00 || r.h.al == 0xe0);
  if (is_extended_key)
    str = __get_extended_key_string((int)r.h.ah)
    printf("Key encoding: %s", str);

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004