Mail Archives: djgpp/2003/08/09/03:15:13
in the program below, I get changing printouts, when I press a key,
though not the key-code.
But when I remove the printf("") , then the printout won't change
on keystroke.
(1) why ?
(2) how do I get the key-code ?
#include <stdio.h>
int getkey() {
int key=55;
__asm__ __volatile__ ("
pushl %%eax
movl $256,%%eax
int $22
andl $255,%%eax
movl %%eax,%0
movl $3072,%%eax
int $33
popl %%eax
":"=g"(key),"=g"(key) );
printf("");
return(key);}
int main(int argc,char*argv[]){
mh7:printf("%i\n",getkey());
goto mh7;
return 0;
}
- Raw text -