Thread: Direction Keys

  1. #1
    esler
    Guest

    Question Direction Keys

    hi
    i am looking for a solutýon
    i wanna find ASCII codes for some keys:
    direction keys
    when i try to find it
    it gives me
    -32,80 for upper direction

    ý cant understand
    where can ý fýnd ASCII codes for these keys

  2. #2
    Ethereal Raccoon Procyon's Avatar
    Join Date
    Aug 2001
    Posts
    189
    Input from the arrow keys will place their scan codes in the buffer (in DOS, at least.) You can then retrieve these scan codes with getch() and related functions. The scan codes are:

    Up: 80
    Down: 72
    Left: 75
    Right: 77

    Example:
    Code:
    int x = 0;
    int y = 0;
    char scancode;
    if (kbhit())
    {
      scancode = getch();
      if (scancode == 72) y--;
      if (scancode == 80) y++; 
      if (scancode == 72) x--;
      if (scancode == 75) x++;
    }
    
    printf("x = %d, y = %d), x, y);

  3. #3
    esler
    Guest

    Unhappy are you sure

    hi
    are you sure
    when ý trýed to wrýte
    alt+80 , ý got 'P'

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simulate Keys with a Keyboard Hook
    By guitarist809 in forum Windows Programming
    Replies: 3
    Last Post: 11-14-2008, 08:14 PM
  2. Mouse Maze Problem
    By Furbiesandbeans in forum C++ Programming
    Replies: 13
    Last Post: 04-28-2008, 04:20 PM
  3. blocking or passing keys with global hook
    By pmouse in forum Windows Programming
    Replies: 4
    Last Post: 08-29-2007, 02:54 PM
  4. Ascii code for direction keys
    By Whizza in forum C++ Programming
    Replies: 3
    Last Post: 05-24-2006, 04:45 AM
  5. Classic problem doesn't accept direction
    By cheesehead in forum C++ Programming
    Replies: 5
    Last Post: 11-13-2001, 06:32 PM