getch()

This is a discussion on getch() within the C++ Programming forums, part of the General Programming Boards category; I realize getch is non-standard but seeing as everyone says there is no way in standard c++ to get the ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    465

    getch()

    I realize getch is non-standard but seeing as everyone says there is no way in standard c++ to get the keystroke without the enter button I plan to use it anyway. In this bit of code getch works for everything key but the arrow keys it registers all of them as the ascii character 224. If someone could let me know why, that would be great.
    Code:
    void Player1Move(char array[75][31]){
         const int xpos=2;
         int ypos=15;
         int input;
         //up arrow ASCII is 24 and down arrow is 25
         input=getch();
         cout<<input;
    }
    My computer is awesome.

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  2. Pls repair my basketball program
    By death_messiah12 in forum C++ Programming
    Replies: 10
    Last Post: 12-11-2006, 05:15 AM
  3. Pause a C program without getch()
    By swgh in forum C Programming
    Replies: 4
    Last Post: 02-20-2006, 11:24 AM
  4. Clearing input buffer after using getch()
    By milkydoo in forum C++ Programming
    Replies: 3
    Last Post: 07-22-2003, 12:04 AM
  5. Problems with getch()
    By GrNxxDaY in forum C++ Programming
    Replies: 14
    Last Post: 08-12-2002, 03:11 AM

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