The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

getnstr, getstr, mvgetnstr, mvgetstr, mvwgetnstr, mvwgetstr, wgetstr, wgetnstr - get a multi-byte character string from the terminal

 SYNOPSIS



#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 character. 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.

 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. The use of getnstr(), mvgetnstr(), mvwgetnstr() or wgetnstr(), respectively, is recommended.

 SEE ALSO

Input Processing , beep(), getch(), <curses.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]