home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list14_6.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
626b
|
37 lines
/* Demonstrates reading extended keys from the keyboard. */
#include <stdio.h>
#include <conio.h>
int ext_key(void);
main()
{
int ch;
puts("Press any extended key; press F1 to exit.");
while (1)
{
ch = ext_key();
if (ch == 59) /* F1? */
break;
else
printf("\nThat key's code has a value of %d.", ch);
}
}
int ext_key(void)
{
int ch;
/* Wait until a zero byte comes in. */
while ((ch = getch()) != 0)
;
/* Return the next character. */
return getch();
}