| delorie.com/archives/browse.cgi | search |
| Lines: | 38 |
| X-Admin: | news AT aol DOT com |
| From: | sterten AT aol DOT com (Sterten) |
| Newsgroups: | comp.os.msdos.djgpp |
| Date: | 09 Aug 2003 06:59:39 GMT |
| Organization: | AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com |
| Subject: | get the last key pressed |
| Message-ID: | <20030809025939.05142.00000265@mb-m01.aol.com> |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
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;
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |