LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How can i get scan code of arrows keys on keyboard (https://www.linuxquestions.org/questions/programming-9/how-can-i-get-scan-code-of-arrows-keys-on-keyboard-672334/)

asifjavaidy2k 09-25-2008 12:07 PM

How can i get scan code of arrows keys on keyboard
 
Hi fellows,


I want to make a snake game in C using gcc compiler. I would like to know how can we get scan codes of arrows and functional keys which we are pressing? I borlandc compiler we can get scan codes using getch() function. but there is no such function in gcc compiler definitly there will some approach in gcc compiler for get scan codes.



Please help me...


Asif
Software Engineer.

SciYro 09-25-2008 12:42 PM

Such things are beyond the responsibilities of the compiler. You need to look to other libraries to do this, such as ncurses, or the standard C library.

I believe getch() is part of ncurses, so look at that.

jb_get 09-25-2008 01:19 PM

It doesn't have to do with gcc. getchar() should work fine under borland or gcc. Make sure your libraries are installed correctly.


All times are GMT -5. The time now is 02:54 PM.