/*********************************/
/* int86() program */
/* author:xwlee */
/* time: 06/11/3 */
/*********************************/
#include "stdio.h"
#include "dos.h"
#define Key_ESC 1
#define Key_A 30
int getkeyscode();
int main()
{
int acount=0,ky;
do
{
ky=getkeyscode();
switch(ky)
{
case Key_A: ++acount; break;
case Key_ESC:
printf("/nEnd the program");
exit(0);
default:
break;
}
printf("/nDuring the program,you press A/a %d times",acount);
}while(1);
getch();
return 0;
}
int getkeyscode()
{
union REGS rg;
rg.h.ah=0;
int86(0X16,&rg,&rg);
return rg.h.ah;
}