ReadKey like Function in C

Ed Nather nather at ut-emx.UUCP
Fri Aug 18 00:02:51 AEST 1989


In article <19095 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
> In article <1677 at crdgw1.crd.ge.com> davidsen at sungod.crd.ge.com (ody) writes:
> >[...] Therefore, since
> >kbhit() and getch() are probably the widest spread, I would suggest that
> >the MS-DOS haters would still like to adopt this convention, since it
> >would simplify porting programs to other operating systems.
> 
> What does `kbhit()' mean when stdin is a socket?  How about in a VMS
> batch job?
> 
> What does getch() do at end of file?
> 
> Before you settle on <X> as a standard across hundreds of systems, be sure
> <X> can well-defined everywhere.

Another question: if we adopt kbhit() do we debug it first, or continue the
bugs into the next generation?

As an example, kbhit() as implemented in MS-DOS has an undocumented "feature"
I had to program around: when the character input on the keyboard is the
Ctrl-C code, and kbhit() is invoked to see if a character is waiting, it
takes it upon itself to abort the program under execution.  

I doubt we'd want to perpetuate such a lousy example of the desired
function.


-- 
Ed Nather
Astronomy Dept, U of Texas @ Austin



More information about the Comp.lang.c mailing list