Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > G


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


getnstr, mvgetnstr, mvwgetnstr, wgetnstr, — get a multi-byte character length limited string from the terminal


#include <curses.h>

int getnstr(char *str, int n);

int mvgetnstr(int y, int x, char *str, int n);

int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n);

int wgetnstr(WINDOW *win, char *str, int n);


The effect of getnstr() and wgetnstr() 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 getnstr() 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 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.


Upon successful completion, these functions return OK. Otherwise, they return ERR.


No errors are defined.


Traditional implementations often limited the number of bytes returned to 256.


beep(3X), getch(3X), curses_intro(3X), see Input Processing, <curses.h>.


First released in X/Open Curses, Issue 4.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.