ReadKey like Function in C

Kevin_P_McCarty at cup.portal.com Kevin_P_McCarty at cup.portal.com
Thu Aug 17 18:51:20 AEST 1989


In <19095 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
>What does `kbhit()' mean when stdin is a socket?  How about in a VMS
>batch job?

kbhit() in the absence of a keyboard owned by the process behaves
similarly to pod_bay_doors_open() in the absence of pod bay doors owned
by the process, namely, the behavior is undefined.  It is an error to
interrogate a device which does not exist.  kbhit() interrogates the
status of a device.  stdin is not a device.  kbhit() is in the same
class as left_mouse_button_pressed().  Neither has anything to do with C
language; neither belongs in a language standard; they are idiosyncratic
to hardware.

>What does getch() do at end of file?

Why, it returns EOF.  getch() returns an int, same as getchar().

Kevin McCarty



More information about the Comp.lang.c mailing list