Jump to content

How to detect the status of a key in ANSI C?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
scanpst

scanpst

    Newbie

  • Members
  • Pip
  • 1 posts
Hi there,
I'm new to this website so hi to all. :)
I'm programming a game in C for Ms-Dos platform. The problem is that functions like scanf or getch would only return to you an ascii character not the status of the key.
i.e. if the user presses a key the game should not move on step forward but keep on moving until that key is kept pressed.

I tried using the bit x417 where the DOS stores the pressed status of keys. But only of special keys like Ctrl and Alt.

So guys, any idea how knowing status of keys like spacebar and the arrowkeys might be possible?:mellow:

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I would look into the DOS API. Alternatively, you can do some research on the address of the keyboard.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog