🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.linux
Article #57881

Re: programming: how to read a key?

#57881
From: A Shelton
Date: Mon, 19 Aug 1996 00:00
25 lines
1253 bytes
freemant@wr.com.au (Kent Tong) writes:


>I'd like to do the following programmtically:

>1. read in a key. It should accept say ctrl-A, Home, PgUp and etc.
>2. translate the key just read into a sequence of ascii characters.

>Can this be done? If so, how?

Not sure, but I suspect that what you need to do is put the terminal
into "raw" mode in which all characters should go directly to
you without buffering. 

Curses will do raw mode, POSIX also has a lot of functions for setting
terminal attributes including raw mode.

A Posix programming book is an EXCELLENT investment for working with
linux (IMO).

--
               Linux/*BSD: Live free or die.
Andrew Shelton 			   s9406182@yallara.cs.rmit.edu.au
  GCS(2.1)-d+H+sw+v-C++UL+>L+++E-N++WV--R++tv-b+D++e+fr*y?
Technical Details
Message-ID: <4vauhi$imh@goanna.cs.rmit.edu.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <4uvh9k$21t@metro.usyd.edu.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 102983,6c7f4d9f7702cf30
X-Google-Attributes: gid102983,public
From: ashelton@yallara.cs.rmit.EDU.AU (A Shelton)
Subject: Re: programming: how to read a key?
Date: 1996/08/19
Message-ID: <4vauhi$imh@goanna.cs.rmit.edu.au>
X-Deja-AN: 175240982
distribution: inet
references: <4uvh9k$21t@metro.usyd.edu.au>
organization: Comp Sci, RMIT, Melbourne, Australia
newsgroups: aus.computers.linux