econoy
08-21-2004, 11:55 AM
I copied those code form a book.Just a simple example.
codes here:
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#define MAX 10
int count=0;
void (interrupt *oldhandle)();
void interrupt key()
{
(*oldhandle)();
disable();
count++;
enable();
}
main()
{
int key;
oldhandle=getvect(9);
setvect(9,key);
while(count<MAX)
{
if(kbhit()!=0)
{
key=getch();
printf("count=%4i,key=%4i\n",count,key);
}
}
setvect(9,oldhandle);
}
But it cannot work.My OS is windows.Is it the reason?
I am a new comer to c.I want to get inputs from user in graphics mode,so I captured interrupt 0x09.In this interrupt function,I get
inputs.Anyone who can give me a better idea?How can I get
inputs in graphics mode?
codes here:
#include<stdio.h>
#include<conio.h>
#include<dos.h>
#define MAX 10
int count=0;
void (interrupt *oldhandle)();
void interrupt key()
{
(*oldhandle)();
disable();
count++;
enable();
}
main()
{
int key;
oldhandle=getvect(9);
setvect(9,key);
while(count<MAX)
{
if(kbhit()!=0)
{
key=getch();
printf("count=%4i,key=%4i\n",count,key);
}
}
setvect(9,oldhandle);
}
But it cannot work.My OS is windows.Is it the reason?
I am a new comer to c.I want to get inputs from user in graphics mode,so I captured interrupt 0x09.In this interrupt function,I get
inputs.Anyone who can give me a better idea?How can I get
inputs in graphics mode?