🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #470

Re: ReadKey like Function in C

#470
From: Alan J Rosenthal
Date: Wed, 16 Aug 1989 13:14
18 lines
1331 bytes
leea@ssc-vax.UUCP (Lee Carver) writes:
>In this zoo of discussion on "getch", i'd like to add a shot in
>support of "kbhit()".  In particular, I'd like kbhit to return
>ture if input is waiting (i.e. getchar will NOT block) and
>false otherwise.

That's obviously standardizable (after all, however you wrote the standard
description it would probably still conform if it always returned false, or
maybe even always true), but it differs from the ibm-pc semantics.  On ibm-pcs,
kbhit() tells you whether or not _getch()_ will block%, not getchar(), and
getch()'s semantics are that it does not block if the user has pressed any
character, whether or not they have pressed return.

On an ibm-pc, if kbhit() returns true, getchar() may still block.

ajr

% Of course, nothing really blocks on the ibm-pc, it just waits.
Technical Details
Message-ID: <1989Aug16.091422.26032@jarvis.csri.toronto.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps
References: <148@trigon.UUCP> <207600029@s.cs.uiuc.edu> <941@lakesys.UUCP> <21175@cup.portal.com> <3705@buengc.BU.EDU> <10712@smoke.BRL.MIL> <3727@buengc.BU.EDU> <10721@smoke.BRL.MIL> <2851@ssc-vax.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!dgp.toronto.edu!flaps
From: flaps@dgp.toronto.edu (Alan J Rosenthal)
Newsgroups: comp.std.c
Subject: Re: ReadKey like Function in C
Message-ID: <1989Aug16.091422.26032@jarvis.csri.toronto.edu>
Date: 16 Aug 89 13:14:22 GMT
References: <148@trigon.UUCP> <207600029@s.cs.uiuc.edu> <941@lakesys.UUCP> <21175@cup.portal.com> <3705@buengc.BU.EDU> <10712@smoke.BRL.MIL> <3727@buengc.BU.EDU> <10721@smoke.BRL.MIL> <2851@ssc-vax.UUCP>
Lines: 18