Thread: How To Check Arrow Keys?

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    14

    How To Check Arrow Keys?

    how i check for arrow keys pressing using standard io functions? (nothing of allegro)

  2. #2
    Registered User
    Join Date
    Jun 2002
    Posts
    35
    I made this simple program to see what code correspond to every key you press on your keyboard using Turbo C++ 3.0

    void main (void)
    {
    char c;

    printf ("Press a key ");
    c = getch ();

    if (c == 0) c = getch ();

    printf ("\n the code for the key you pressed is %.0f ", (float)c);
    fflush (stdin);
    }

    Now you know the code, so you can use

    if (c == 72) then ......

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    35
    Sorry but i don't know how to tab

  4. #4
    i dont know Vicious's Avatar
    Join Date
    May 2002
    Posts
    1,200
    just put thing in between code blocks. You cant tab though so just mash space 4 times:

    Code:
    int main () 
    { 
        char c; 
    
        printf ("Press a key "); 
        c = getch (); 
    
        if (c == 0) c = getch (); 
    
       printf ("\n the code for the key you pressed is %.0f ", (float)c); 
       fflush (stdin); 
    }
    What is C++?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. arrow keys in arrays
    By tunerfreak in forum C++ Programming
    Replies: 5
    Last Post: 03-06-2006, 01:26 PM
  3. Arrow keys
    By Katushai in forum C++ Programming
    Replies: 1
    Last Post: 03-27-2005, 01:43 PM
  4. Arrow keys!
    By Paninaro in forum C Programming
    Replies: 8
    Last Post: 06-26-2002, 07:39 PM
  5. msdos arrow keys?
    By seditee in forum Game Programming
    Replies: 3
    Last Post: 05-07-2002, 11:29 PM