🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #3075

Re: getchar() without <enter> in emx gcc?

#3075
From: min-woong sohn
Date: Sat, 21 Nov 1992 18:38
16 lines
1031 bytes
In article <1992Nov21.154701.16804@grebyn.com> richk@grebyn.com (Richard Krehbiel) writes:
>This is a very common FAQ in comp.lang.c, so I hate to ask....
>
>How do you read a single character from the keyboard without requiring
>hitting ENTER, and without echo?
>

It's in the emx doc. You need to use _read_kbd() as follows:

#include <stdlib.h>
#define getch() _read_kbd(0,1,0)
#define getche() _read_kbd(1,1,0)

Now getch() will not echo the character and getche() will.

Min
Technical Details
Message-ID: <1992Nov21.183800.19415@midway.uchicago.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!quads!soh3
References: <1992Nov21.154701.16804@grebyn.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uchinews!quads!soh3
From: soh3@quads.uchicago.edu (min-woong sohn)
Subject: Re: getchar() without <enter> in emx gcc?
Message-ID: <1992Nov21.183800.19415@midway.uchicago.edu>
Sender: news@uchinews.uchicago.edu (News System)
Reply-To: soh3@midway.uchicago.edu
Organization: University of Chicago 
References: <1992Nov21.154701.16804@grebyn.com>
Distribution: usa
Date: Sat, 21 Nov 1992 18:38:00 GMT
Lines: 19