🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

getchar() without <enter> in emx gcc?

#3072
From: Richard Krehbiel
Date: Sat, 21 Nov 1992 15:47
24 lines
1225 bytes
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?

Specifically, this is in emx gcc 0.8e.  I'm incuding what I'm trying
now, but it doesn't work.  It does in Unix, which I thought the termio
interface in emx was supposed to emulate.

        setbuf(stdin, NULL);
        ioctl(0, TCGETA, &tio);
        tio.c_lflag &= ~(ICANON | ECHO);
        tio.c_cc[VMIN] = 1;
        tio.c_cc[VTIME] = 0;
        tio.c_cc[VEOL] = 0;
        ioctl(0, TCSETA, &tio);

After this, characters are still automatically echoed and buffered,
etc.

(And if this is a FAQ, please don't hit me too hard...)
-- 
Richard Krehbiel                                 richk@grebyn.com
OS/2 2.0 will do for me until AmigaDOS for the 386 comes along...
Technical Details
Message-ID: <1992Nov21.154701.16804@grebyn.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!grebyn!daily!richk

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!grebyn!daily!richk
From: richk@grebyn.com (Richard Krehbiel)
Subject: getchar() without <enter> in emx gcc?
Message-ID: <1992Nov21.154701.16804@grebyn.com>
Lines: 21
Sender: richk@grebyn.com (Richard Krehbiel)
Organization: Grebyn Timesharing
Distribution: usa
Date: Sat, 21 Nov 1992 15:47:01 GMT