simpl ANSI C question

Started by
0 comments, last by AeroZeplyn 24 years, 1 month ago
for this program i am making, i need to know how to detect keys like CTRL, ALT, and SHIFT in PURE DOS. does anyone out there know how to do this with C or assembly language? thanks! - Aero
Advertisement
Try this:

#include
#include

void main(void)
{
char sel;

do {
sel=getch();
printf("%x\n", sel);
}while(sel != 0x1b);
}

In the example above sel is assigned a value from getch() and displayed in hex using printf() until the Esc key is typed. The value of sel is diffrent if Alt, Ctrl or Shift typed. If you type in the letter a you get 0x61 but if you hold the Ctrl key and type a you get 0x01.

This may or may not help you but this is how I do it.
http://www.crosswinds.net/~druidgames/resist.jpg

This topic is closed to new replies.

Advertisement