General Question

LeotCol's avatar

Is there a simple way for checking keypressed in C (Not C++ or C#)?

Asked by LeotCol (2240 points ) December 24th, 2009

I would just like to get into making some very very basic visual stuff in plain C. Even in the dos style screen. Is there a way of taking in the directional arrows as input and acting on that?

Edit: I have a feeling this will become a poor poor orphan question =[

Observing members: 0 Composing members: 0

4 Answers

Ranimi23's avatar

Use getchar() function and check what is the char.

HasntBeen's avatar

That kind of function is platform-specific. What compiler and operating system are you using?

LeotCol's avatar

I’m using Windows 7 and compiling with Borland C/C++ Compiler

HasntBeen's avatar

It’s been a long time since I worked with Borland, but I found this:

http://www.daniweb.com/forums/thread138413.html#

I do remember using the kbhit() function to detect the presence or absence of a keystroke before calling getchar();

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther