getnstr(3X) getnstr(3X)
NAME
getnstr, getstr, mvgetnstr, mvgetstr, mvwgetnstr, mvwgetstr, wgetstr,
wgetnstr - get a multi-byte character string from the terminal
SYNOPSIS
cc [flag ...] file ... -lcurses [library ...]
#include <curses.h>
int getnstr(char *str, int n);
int getstr(char *str);
int mvgetnstr(int y, int x, char *str, int n);
int mvgetstr(int y, int x, char *str);
int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n);
int mvwgetstr(WINDOW *win, int y, int x, char *str);
int wgetnstr(WINDOW *win, char *str, int n);
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, carriage return or end-of-file is received. The
resulting value is placed in the area pointed to by str. The string is
then terminated with a null byte. The getnstr(), mvgetnstr(),
mvwgetnstr() and wgetnstr() functions read at most n bytes, thus
preventing a possible overflow of the input buffer. 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(). The mvgetnstr() function is identical to getnstr() except
that it is as though it is a call to move() and then a series of calls
to getch(). The mvwgetnstr() function is identical to getnstr() except
it is as though a call to wmove() is made and then a series of calls
to wgetch().
The getnstr(), wgetnstr(), mvgetnstr() and mvwgetnstr() functions will
only return the entire multi-byte sequence associated with a charac-
ter. If the array is large enough to contain at least one character,
the functions fill the array with complete characters. If the array is
not large enough to contain any complete characters, the function
fails.
Page 1 Reliant UNIX 5.44 Printed 11/98
getnstr(3X) getnstr(3X)
RETURN VALUE
Upon successful completion, these functions return OK. Otherwise, they
return ERR.
ERRORS
No errors are defined.
NOTES
Reading a line that overflows the array pointed to by str with
getstr(), mvgetstr(), mvwgetstr() or wgetstr() causes undefined
results. The use of getnstr(), mvgetnstr(), mvwgetnstr() or
wgetnstr(), respectively, is recommended.
SEE ALSO
beep(3X), curses(3X), getch(3X), curses(5).
Page 2 Reliant UNIX 5.44 Printed 11/98