🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #1042

Keyboard input processing -- rolling one's own?

#1042
From: Elliot H. Mednick
Date: Fri, 28 Aug 1992 19:12
23 lines
1348 bytes
An application that I am developing requires a more sophisticated keyboard
input processing than getc() can provide.  getc (stdin) returns only
when a crlf is detected.

I need (to write) a routine that returns either at the end of a line
or if the _first_ character typed is a specified "hot key" (e.g. a
function key).  As a side-effect, I need each key pressed to echo to
stdout and also to tee into a file (for a keystroke saver).

I would like this routine to handle file streams, as well (without the
"hot key" detection).

In Borland C++ (3.0) and MSC, there is a routine called getch which
gets a character directly from the console.  I can use this and
isatty() to write my own getc that does what I want.  The problem is,
I would like to attempt to make this routine portable to other
compilers and to UN*X; i.e. using ANSIC or C++ constructs only.
getch() is _not_ ANSI.

Is this possible?

Thanks in advance.
-Elliot
Technical Details
Message-ID: <715029154snx@Wellspring.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!unixland!wellspring!elliot

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!unixland!wellspring!elliot
From: elliot@Wellspring.COM (Elliot H. Mednick)
Newsgroups: comp.os.msdos.programmer
Subject: Keyboard input processing -- rolling one's own?
Distribution: world
Message-ID: <715029154snx@Wellspring.COM>
Date: Fri, 28 Aug 92 19:12:34 GMT
Organization: Wellspring Solutions, Sutton, MA.
Reply-To: elliot@Wellspring.COM
Lines: 23