anyone know how to make a cursor move using the arrow keys with ncurses?
anyone know how to make a cursor move using the arrow keys with ncurses?
I'd start by reading
NCURSES Programming HOWTO
Writing Programs with NCURSES
Just doing a search for "cursor" through both documents should help you home in on your answer.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
anyone know why this code gives me this error
sudoku.c: In function 'main':Code:// cursor goes up case 'KEY_UP': g.y++; g.x++; move(g.x,g.y); break;
sudoku.c:165:18: error: character constant too long for its type [-Werror]
cc1: all warnings being treated as errors
make: *** [sudoku] Error 1
line 165 is case 'KEY_UP':
KEY_UP is presumably an integer constant defined somewhere earlier in your code, but when you use the single quotes around it you are not referring to the constant KEY_UP, but are testing for a case where the switched value is 'KEY_UP'.
Using for example case 'a': would be ok since it's only 1 char. So, just remove the single quotes.
Edit: Actually KEY_UP is defined in curses.h, but the point remains.
Last edited by Subsonics; 09-12-2012 at 07:47 PM.