Thread: Direction Keys

  1. #1

    Question Direction Keys

    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
    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

    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

    Unhappy are you sure

    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