home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 September
/
Simtel20_Sept92.cdr
/
msdos
/
turbo_c
/
tc130.arc
/
GETKEY.DOC
< prev
next >
Wrap
Text File
|
1987-08-20
|
1KB
|
41 lines
NAME
getkey -- extended keyboard fetch
SYNOPSIS
#include "keys.h"
r = getkey();
int r; returns keyboard value
DESCRIPTION
This function eases the reading of all keys, whether normal
or function keys. The getch() function is used to return a keyboard
value. If the first value received is 0, then a second value
is fetched and 256 (0x100) is added to flag the return value
as an extended function key. The calling program should check
for a return value greater than 255. If true, subtract 256 (or
"and" with 0xff) and consider the result as a function key.
Most function keys are defined in keys.h, and others may be user added.
EXAMPLE
This example tests for function key 3 (FK3)
#include "keys.h"
int r;
while(TRUE) {
r = getkey();
if(r < 256) {
printf("Not FK3 key");
continue;
}
else r &= 0xff;
if(r == FK3) printf("FK3 sensed!!!");
}
This function is found in SMTCx.LIB for the Turbo-C Compiler.