]> ncurses.scripts.mit.edu Git - ncurses.git/blob - man/curs_getstr.3x
ncurses 4.1
[ncurses.git] / man / curs_getstr.3x
1 .TH curs_getstr 3X ""
2 .SH NAME
3 \fBgetstr\fR, \fBwgetstr\fR, \fBmvgetstr\fR,
4 \fBmvwgetstr\fR, \fBwgetnstr\fR - accept character strings from
5 \fBcurses\fR terminal keyboard
6 .SH SYNOPSIS
7 \fB#include <curses.h>\fR
8
9 \fBint getstr(char *str);\fR
10 .br
11 \fBint getnstr(char *str, int n);\fR
12 .br
13 \fBint wgetstr(WINDOW *win, char *str);\fR
14 .br
15 \fBint mvgetstr(int y, int x, char *str);\fR
16 .br
17 \fBint mvwgetstr(WINDOW *win, int y, int x, char *str);\fR
18 .br
19 \fBint mvgetnstr(int y, int x, char *str, int n);\fR
20 .br
21 \fBint mvwgetnstr(WINDOW *, int y, int x, char *str, int n);\fR
22 .br
23 \fBint wgetnstr(WINDOW *win, char *str, int n);\fR
24 .br
25 .SH DESCRIPTION
26 The function \fBgetstr\fR is equivalent to a series of calls to \fBgetch\fR,
27 until a newline or carriage return is received (the terminating character is
28 not included in the returned string).  The resulting value is placed in the
29 area pointed to by the character pointer \fIstr\fR.
30
31 \fBwgetnstr\fR reads at most \fIn\fR characters, thus preventing a possible
32 overflow of the input buffer.  Any attempt to enter more characters (other
33 than the terminating newline or carriage return) causes a beep.  Function
34 keys also cause a beep and are ignored.  The \fBgetnstr\fR function reads
35 from the \fIstdscr\fR default window.
36
37 The user's erase and kill characters are interpreted.  If keypad
38 mode is on for the window, \fBKEY_LEFT\fR and \fBKEY_BACKSPACE\fR
39 are both considered equivalent to the user's kill character.
40
41 Characters input are echoed only if \fBecho\fR is currently on.  In that case,
42 backspace is echoed as deletion of the previous character (typically a left
43 motion).
44 .SH RETURN VALUE
45 All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4
46 specifies only "an integer value other than \fBERR\fR") upon successful
47 completion.
48 .SH NOTES
49 Note that \fBgetstr\fR, \fBmvgetstr\fR, and \fBmvwgetstr\fR may be macros.
50 .SH PORTABILITY
51 These functions are described in the XSI Curses standard, Issue 4.  They read
52 single-byte characters only.  The standard specifies that they return \fBERR\fR
53 on failure, but the single error condition \fBEOVERFLOW\fR associated with
54 extended-level conformance is not yet returned (the XSI curses support for
55 multi-byte characters is not yet present).
56
57 SVr3 and early SVr4 curses implementations did not reject function keys;
58 the SVr4.0 documentation claimed that "special keys" (such as function
59 keys, "home" key, "clear" key, \fIetc\fR.) are interpreted" without
60 giving details.  It lied.  In fact, the `character' value appended to the
61 string by those implementations was predictable but not useful
62 (being, in fact, the low-order eight bits of the key's KEY_ value).
63
64 The functions \fBgetnstr\fR, \fBmvgetnstr\fR, and \fBmvwgetnstr\fR were
65 present but not documented in SVr4.
66 .SH SEE ALSO
67 \fBcurses\fR(3X), \fBcurs_getch\fR(3X).
68 .\"#
69 .\"# The following sets edit modes for GNU EMACS
70 .\"# Local Variables:
71 .\"# mode:nroff
72 .\"# fill-column:79
73 .\"# End: