Xref: utzoo comp.sys.ibm.pc.misc:5387 comp.os.msdos.programmer:2755 Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!udel!haven!adm!cmcl2!uupsi!fozzie!stanley From: stanley@phoenix.com (John Stanley) Newsgroups: comp.sys.ibm.pc.misc,comp.os.msdos.programmer Subject: Re: help! dos(?) is grabbing half my alt keys Message-ID: Date: 8 Jan 91 17:01:21 GMT References: <1991Jan7.230518.25949@uunet!unhd> Organization: Not BIFF At All (NBAA) Lines: 34 rg@msel.unh.edu (Roger Gonzalez) writes: > In Turbo C++ version 1.0: > > #include > #include > main() > { > int c, done; > > done = 0; > printf("Hit a key, to quit\n"); > while (!done) { > c = getch(); > printf("keyboard scan code 0x%02x\n", c); > if (c == 27) > done = 1; > } > } > > Simple, right? > > Why is it that the second half of the 2 byte sequence transmitted by > certain alt keys sometimes gets absorbed and used by DOS? For example, > R transmits the sequence 0x00 0x13. Every now and then, the output > will get hung as if the 0x13 (which is ^S) was typed: > keyboard sc You are probably getting caught by the I/O statement (printf) letting DOS look at the keys, or by TurboC looking. The TurboC docs say something about control-C checking occuring during I/O. Try doing an immediate second getch() if the first getch() returns 0.