keyreader.h


Headers Index Help      Within this page: Functions Constants Variables


Overview

Keyreader library functions

This library allows a program to read a single key at a time from the terminal. Unlike the normal line input mode, which allows the line being input to be edited before it is released to the program when Enter is pressed, each character is sent to the program as the key is pressed. The advantage is that single keystrokes can be input: the disadvantage is that any input editing and correction capabilities must be provided by the calling program.

Copyright (C) 2009 Martin C Gregorie

This program is free software; you can redistribute it and/or modify it under the terms of the Lesser GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the Lesser GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Contact Martin Gregorie at martin@gregorie.org

Functions


krend

#include <keyreader.h>

void krend();

Restore the original terminal attributes and keyboard signals.

In: keyreader.c

Return to the top

krgetchar

#include <keyreader.h>

char krgetchar();

Read an input character. -1 is returned on EOF (Ctrl-D pressed) -2 is returned if an error ocurred. errno is set.

In: keyreader.c

Return to the top

krinit

#include <keyreader.h>

void krinit();

Initialise the single key reading mode.

Keyboard signals are blocked and the current terminal attributes are saved. Terminal attributes are changed to enable character at a time input without echoing keypresses.

In: keyreader.c

Return to the top

Public constants were not declared.
Public variables were not declared.
Return to the top