how to detect arrow key inputs in c without using getch of conio.h.

well i am trying to create a game in c which requires the use of arrow keys as input. the book where i came across this question gives a function definition that is required to detect arrow key inputs. but the function given in the book requires the presence of conio.h which i don’t have. i am using a virtual machine which runs linux and it doesnt have conio.h in its library. why conio.h is used in the function is because the function uses getch() to detect arrow keys. i am pretty much a beginner in c,so i have 2 questions for you

  1. how to make my own user defined function that does not require conio.h so that i can detect arrow keys?
  2. how do you add/import header files that your ide doesnt have? how do i add conio.h to my ide?is there any safe/official website where you can get conio.h for free?how to add the downloaded file to my ide?

http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/misc.html#TEMPLEAVE

@bugkiller need more help.

Well, you will have to do quite research reading NCurses and PDcurses, which I don’t know :stuck_out_tongue:

All I know is that while using getch() pressing one arrow key pushes three values in the buffer, the escape sequence, the [ and the corresponding A, B, C, or D to the arrow key pressed.

Without using getch, the only alternative I can give you for the time being is to use W, A, S, D combination to use instead of Up, Left, Down, and Right keys. The W.A.S.D combination is very famous in gaming world. :smiley:

well i still didnt get the answer im looking for in that link.pls help. okay could somebody pls write a fnt which works exactly the way getch() works. that would be really helpful.