NAME

inkeyS - get a “keystroke”

SYNOPSIS

#include <basic/string.h>

struct string inkeyS()

DESCRIPTION

InkeyS implements the BASIC INKEY$ variable which, apparently, accesses the BIOS code of the IBM PC.  This accounts for the strange behavior of this variable and thus the inkeyS function. 

InkeyS attempts to read a character from the current file (see initio(io)).  This function waits no more than one second for a character or character sequence to arrive (see alarm(io)).  If no character is present, the null string is returned.  If a single character is present, a one character string is allocated and returned.  If a character sequence (or is the null character) is present, inkeyS allocates and returns a two character string consisting of a null character followed by another character code as given in the table below. 

The interpretation of special function keys requires knowledge of the sequences generated by the terminal.  This information is gleaned from the terminal capabilities database which is termcap(5) or terminfo(4), depending on the ancestry of the system.  If a particular sequence for a given terminal is not defined, this function will not recognize the sequence as such.  In this case, The Intrepid Reader who has mustered the audacity to modify the database will find in the table below the i.codes used with termcap and the capnames and term structure names used with terminfo. 

      Code      I.Code      Capname      Term Name      Description
 
  3Null character
58k0kf0key_f0Function key F0
59k1kf1key_f1Function key F1
60k2kf2key_f2Function key F2
61k3kf3key_f3Function key F3
62k4kf4key_f4Function key F4
63k5kf5key_f5Function key F5
64k6kf6key_f6Function key F6
65k7kf7key_f7Function key F7
66k8kf8key_f8Function key F8
67k9kf9key_f9Function key F9
68kakf10key_f10Function key F10
71khkhomekey_homeHome
72kukcuu1key_upCursor up
73kPkppkey_ppagePage up
75klkcub1key_leftCursor left
77krkcuf1key_rightCursor right
79kHkllkey_llEnd (Home down)
80kdkcud1key_downCursor down
81kNknpkey_npagePage down
82kIkich1key_icInsert
83kDkdch1key_dcDelete

Characters read from a full-duplex tty are not echoed. 

If the current file is a half-duplex tty (see io(inc)), inkeyS simply allocates and returns a string consisting of a single character read from the current file. 

This function resets the current file. 

SEE ALSO

io(inc), string(inc), alarm(io), initio(io)
inkey$(vrbl)
terminfo(4) or termcap(5) in the UNIX Programmer’s Manual

BUGS

If a character sequence arrives very late in the time allotted, the end of the sequence may be lost and not recognized as a sequence. 

If this function is used to poll the file during other processing and there is no input available, a delay is created. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber