problem with arrow keys and MSVC++

This is a discussion on problem with arrow keys and MSVC++ within the C++ Programming forums, part of the General Programming Boards category; i know that in REGULAR compilers that is u hit an arrow key, there are 2 values returned, first a ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    221

    problem with arrow keys and MSVC++

    i know that in REGULAR compilers that is u hit an arrow key, there are 2 values returned, first a NULL, then an uppercase letter depending on the key pressed

    why is it in microsoft's visual C, it returns either a -34 or a 224 and not a null

    and yes, i do mean, -34 or 224
    i have 2 different programs im working on, and one of them returns a -34 as the first value and the other returns a 224 as the second

    this is with using the getch() function

  2. #2
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    explain please?

  3. #3
    Magically delicious LuckY's Avatar
    Join Date
    Oct 2001
    Posts
    856
    Consider the 8-bit value:
    11100111

    Imagine that you have a char var and it contains this value. When you print it, it will print -25.
    Now imagine that you have an unsigned char var with the same value. When you print it, you will see 231.

    The value printed depends on the type of variable it belongs to. Unsigned vars look at the msb (most significant bit) as just being part of the value. Signed vars look at it to determine if the remaining bits represent a positive or negative value.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. accelerator keys in win32 API
    By bennyandthejets in forum Windows Programming
    Replies: 2
    Last Post: 11-09-2002, 08:42 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21