Category : C Source Code
Archive   : KEYS.ZIP
Filename : KEYS.DOC

 
Output of file : KEYS.DOC contained in archive : KEYS.ZIP
******************************************************************************
* *
* Key recognition macros & functions courtesy of Dr. Bob -- 1985 *
* *
****************************************************************************** *



These files help make recognizing IBM's 'special' keys from a C program a
little more painless. The more commonly used macros (by me anyway) are
included in the file KEYS.H. If there are ones missing that you would like
to add, just run KEYFILE.EXE. This will create the file KEYS.NEW with the
new macros. You can then append KEYS.NEW to your KEYS.H file.

KEYFILE will prompt you to enter a macro followed by the key it
represents. For example, if you enter ALT_Q for the macro and then press
the and keys together, the following line will be added to the
file KEYS.NEW:

#define ALT_Q 144

The source to KEYFILE.C is included in case you want to see what's going on.

To use these macros your program needs to call inch() or kb() which
are included (source code) in the file inkey.c. inch() waits for a keypress,
kb() polls the keyboard without waiting (it returns 0 if no key has been
pressed). These functions return the ASCII value of the key pressed or
(if the key has an extended code) the code of the key with the high bit set.
If the code > 127 then your program knows that a special key has been
pressed. This includes all function key combos, cursor control pad, Ins,
Del, and all ALT key combos (but not Ctrl A - Ctrl Z).

Example:
c == inch();

if (c > 127) {

if (c == ALT_PGUP)
go_top();

if (c== ALT_PGDN)
go_bottom():

/* etc. */


} else putchar(c);




kb() uses the Aztec library bdos() call, be sure it matches your
library's version in format (or modify it accordingly).


Enjoy,
Dr. Bob
=MZt=ZMté¡l±Óà+p£WöRt+Ä>N&‹£„&‹E£U麰ë° P.‹Sèh´>Í!Xé—P»ÿÿ´HÍ!XƒûrÖ;ÃwҀ>gu

  3 Responses to “Category : C Source Code
Archive   : KEYS.ZIP
Filename : KEYS.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/