I have a problem with my C++ app and I don't know whether its the code or the terminal. I am trying to detect key presses but when I press a key it just prints it to the screen, i.e. the up arrow prints ^[[A. When i press enter all the code runs at once.
And no, Im not taking user input and then just printing it out.
Any help would be great.
#include <stdio.h>
int main()
{
    char ch;
        do{
            ch=getchar();
             if(ch==65)
                printf("You pressed UP key\n");
             else if(ch==66)
                printf("You pressed DOWN key\n");
             else if(ch==67)
                printf("You pressed RIGHT key\n");
             else if(ch==68)
                printf("You pressed LEFT key\n");
        }while(true);
 return 0;
}
