ReadKey like Function in C
Leslie Mikesell
les at chinet.chi.il.us
Mon Aug 21 11:23:08 AEST 1989
In article <2855 at ssc-vax.UUCP> leea at ssc-vax.UUCP (Lee Carver) writes:
>>What does `kbhit()' mean when stdin is a socket? How about in a VMS
>>batch job?
>>Before you settle on <X> as a standard across hundreds of systems, be sure
>><X> can well-defined everywhere.
>Yes, but 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.
But what we really need is a way to determine *how many* characters
can be requested by a read() on an arbitrary stream (tty/file/pipe)
without blocking. If you are going to ask for some new standard it
might as well be useful - moving data with 1 character read()'s is
not a good way to do things.
Les Mikesell
More information about the Comp.lang.c
mailing list