getstr(3X)
CURSES
NAME
getstr, mvgetstr, mvwgetstr, wgetstr — get a multi-byte character string from the terminal
SYNOPSIS
#include <curses.h>
int getstr(char *str);
int mvgetstr(int y, int x, char *str);
int mvwgetstr(WINDOW *win, int y, int x, char *str);
int wgetstr(WINDOW *win, char *str);
DESCRIPTION
The effect of getstr() is as though a series of calls to getch() were made, until a newline or carriage return is received. The resulting value is placed in the area pointed to by str. The user’s erase and kill characters are interpreted, as well as any special keys (such as function keys, home key, clear key, and so on).
The mvgetstr() function is identical to getstr() except that it is as though it is a call to move() and then a series of calls to getch(). The mvwgetstr() function is identical to getstr() except it is as though a call to wmove() is made and then a series of calls to wgetch().
RETURN VALUE
Upon successful completion, these functions return OK. Otherwise, they return ERR.
ERRORS
No errors are defined.
APPLICATION USAGE
Reading a line that overflows the array pointed to by str with getstr(), mvgetstr(), mvwgetstr() or wgetstr() causes undefined results.
Traditional implementations often limited the number of bytes returned to 256.
SEE ALSO
Input Processing in curses_intro, beep(), getch(), getnstr(), <curses.h>.
CHANGE HISTORY
First released in X/Open Curses, Issue 2.
Issue 3
In X/Open Curses, Issue 3, the getstr(), mvgetstr(), mvwgetstr() and wgetstr() functions were described in the addstr() entry. In X/Open Curses, Issue 4, the DESCRIPTION of these functions is rewritten for clarity and is updated to indicate that they will handle multi-byte sequences correctly.
Hewlett-Packard Company — HP-UX Release 10.20: July 1996