Keyboard Input (arrows)

Apr 15, 2010 at 12:28pm
Hi. I'm trying to make a simple c++ console game.

And i wrote a program to find the values corresponding to keys.

#include <iostream>
#include <conio.h>
using namespace std;

int main(){
int a;
a=getch();
cout << a;
cin.get();

}

However, there is a problem that i get the same value (224) for all arrow keys. So, i couldn't use the arrow keys to make my character move...

Apr 15, 2010 at 12:38pm
Arrow keys produce two characters, btw you shouldn't use conio.h, the curses libraries are much better
Apr 15, 2010 at 10:26pm
Topic archived. No new replies allowed.