GETCHR
Section: C Library Functions (3)
Updated: 10/23/82
Index
Return to Main Contents
NAME
getchr - ask user to type a character
SYNOPSIS
#include <stdio.h>
int getchr (prompt,legals,defalt);
char *prompt,*legals,defalt;
DESCRIPTION
Getchr
will print its prompt and ask the user for a single character.
If that
charactter is in the string of legal response characters
(legals),
then its index is returned.
If a null string is typed (just a
carriage return), then the default character
(defalt)
will be assumed and its index returned.
If a character is typed
which is not in the string of legal responses, then an error message
is printed and the prompt-and-response cycle is repeated.
SEE ALSO
getbool(3),
getstr(3),
getstab(3),
etc.
chrarg(3)
BUGS
There is no provision for an escape response (e.g.
"I don't like any
of these choices").
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- SEE ALSO
-
- BUGS
-
This document was created by
man2html,
using the manual pages.
Time: 12:52:17 GMT, May 26, 2025