Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!ames!ucbcad!ucbvax!decvax!tektronix!uw-beaver!ssc-vax!uvicctr!sbanner1 From: sbanner1@uvicctr.UUCP (S. John Banner) Newsgroups: comp.lang.c,comp.sys.ibm.pc Subject: Re: Unbuffered I/O using MicroSoft C 3.0 Message-ID: <217@uvicctr.UUCP> Date: Thu, 15-Jan-87 14:49:46 EST Article-I.D.: uvicctr.217 Posted: Thu Jan 15 14:49:46 1987 Date-Received: Tue, 20-Jan-87 22:46:22 EST References: <1867@sunybcs.UUCP> <645@uw-warp.UUCP> Reply-To: sbanner1@uvicctr.UUCP (S. John Banner) Organization: University of Victoria, Victoria B.C. Canada Lines: 38 Xref: mnetor comp.lang.c:792 comp.sys.ibm.pc:1105 In article <645@uw-warp.UUCP> tom@uw-warp.UUCP (Tom May) writes: >In article <1867@sunybcs.UUCP>, ugwayne@sunybcs (Wayne Nelligan) writes: >So, here is the promised routine which invokes MS-DOS to get a >character from the keyboard (not stdin) without echoing it. It also >does some things which are obvious from looking at the code. > >#include >int >grokchar() { > union REGS regs; > > regs.h.ah = 7; /* get char no echo */ > intdos (®s, ®s); > return (regs.h.al == 26 ? EOF : regs.h.al == '\r' ? '\n' : regs.h.al); >} you can actually do the same thing without resorting to DOS in mscv4.0, and I understand it works in earlyer versions as well (I got the trick from a freind of mine using v2.something). grokchar() { while (!kbhit()) ; return getc(); } I am not totally sure that I have the right funtion names here, but I know they are pretty close (you might try fgetc if getc doesn't work), and I may have the wrong name for kbhit, but the names should be pretty obvious. S. John Banner ...!uw-beaver!uvicctr!sbanner1 ccsjb@uvvm sbanner1@uvunix.UVIC.CDN