Path: utzoo!attcan!uunet!lll-winken!ames!xanth!mcnc!decvax!ima!mirror!frog!john From: john@frog.UUCP (John Woods) Newsgroups: comp.lang.c Subject: Re: ReadKey like Function in C Message-ID: <1819@frog.UUCP> Date: 21 Aug 89 22:12:00 GMT References: <148@trigon.UUCP> <225800206@uxe.cso.uiuc.edu> <2855@ssc-vax.UUCP> Organization: Misanthropes-R-Us Lines: 16 In article <2855@ssc-vax.UUCP>, leea@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@frog.UUCP, ...!mit-eddie!jfw, jfw@eddie.mit.edu