ReadKey like Function in C

John Woods john at frog.UUCP
Tue Aug 22 08:12:00 AEST 1989


In article <2855 at ssc-vax.UUCP>, leea at ssc-vax.UUCP (Lee Carver) writes:
> ...kbhit() can be "well defined" for all streams.  kbhit()
> should return true if the next "getch()" (or read ( fd, buf, 1 ))
> will NOT block.  This means that the data must already be available
> to the OS, and simply awaits transfer to the application.

Block for how long?  Does this mean that a disk file will return false if
the block isn't already in the in-memory disk cache?  If it must return true,
what if some clucko has accidently powered off that disk drive?  [I once
did this accidently to an HP3000.  It patiently waited for me to notice my
mistake and turn it back on, gently chiding me on the console.  Nary a hiccup
other than that.]  How about a device driver that presents data to the kernel,
but invalidates it if not read in time?  Gee, maybe it isn't so well defined...
-- 
John Woods, Charles River Data Systems, Framingham MA 508-626-1101
...!decvax!frog!john, john at frog.UUCP, ...!mit-eddie!jfw, jfw at eddie.mit.edu



More information about the Comp.lang.c mailing list