2 <BODY BGCOLOR="#99ccbb" TEXT="#000000" LINK="#4060b0" VLINK="#000080" ALINK="#ff4040">
4 <STRONG>getstr</STRONG>, <STRONG>wgetstr</STRONG>, <STRONG>mvgetstr</STRONG>, <STRONG>mvwgetstr</STRONG>, <STRONG>wgetnstr</STRONG> - accept
5 character strings from <STRONG>curses</STRONG> terminal keyboard
10 <STRONG>#include</STRONG> <STRONG><curses.h></STRONG>
12 <STRONG>int</STRONG> <STRONG>getstr(char</STRONG> <STRONG>*str);</STRONG>
13 <STRONG>int</STRONG> <STRONG>getnstr(char</STRONG> <STRONG>*str,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG>
14 <STRONG>int</STRONG> <STRONG>wgetstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>char</STRONG> <STRONG>*str);</STRONG>
15 <STRONG>int</STRONG> <STRONG>mvgetstr(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>char</STRONG> <STRONG>*str);</STRONG>
16 <STRONG>int</STRONG> <STRONG>mvwgetstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>char</STRONG> <STRONG>*str);</STRONG>
17 <STRONG>int</STRONG> <STRONG>mvgetnstr(int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>char</STRONG> <STRONG>*str,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG>
18 <STRONG>int</STRONG> <STRONG>mvwgetnstr(WINDOW</STRONG> <STRONG>*,</STRONG> <STRONG>int</STRONG> <STRONG>y,</STRONG> <STRONG>int</STRONG> <STRONG>x,</STRONG> <STRONG>char</STRONG> <STRONG>*str,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG>
19 <STRONG>int</STRONG> <STRONG>wgetnstr(WINDOW</STRONG> <STRONG>*win,</STRONG> <STRONG>char</STRONG> <STRONG>*str,</STRONG> <STRONG>int</STRONG> <STRONG>n);</STRONG>
23 <H2>DESCRIPTION</H2><PRE>
24 The function <STRONG>getstr</STRONG> is equivalent to a series of calls to
25 <STRONG>getch</STRONG>, until a newline or carriage return is received (the
26 terminating character is not included in the returned
27 string). The resulting value is placed in the area
28 pointed to by the character pointer <EM>str</EM>.
30 <STRONG>wgetnstr</STRONG> reads at most <EM>n</EM> characters, thus preventing a
31 possible overflow of the input buffer. Any attempt to
32 enter more characters (other than the terminating newline
33 or carriage return) causes a beep. Function keys also
34 cause a beep and are ignored. The <STRONG>getnstr</STRONG> function reads
35 from the <EM>stdscr</EM> default window.
37 The user's erase and kill characters are interpreted. If
38 keypad mode is on for the window, <STRONG>KEY_LEFT</STRONG> and
39 <STRONG>KEY_BACKSPACE</STRONG> are both considered equivalent to the user's
42 Characters input are echoed only if <STRONG>echo</STRONG> is currently on.
43 In that case, backspace is echoed as deletion of the pre-
44 vious character (typically a left motion).
48 <H2>RETURN VALUE</H2><PRE>
49 All routines return the integer <STRONG>ERR</STRONG> upon failure and an <STRONG>OK</STRONG>
50 (SVr4 specifies only "an integer value other than <STRONG>ERR</STRONG>")
51 upon successful completion.
56 Note that <STRONG>getstr</STRONG>, <STRONG>mvgetstr</STRONG>, and <STRONG>mvwgetstr</STRONG> may be macros.
60 <H2>PORTABILITY</H2><PRE>
61 These functions are described in the XSI Curses standard,
62 Issue 4. They read single-byte characters only. The
63 standard specifies that they return <STRONG>ERR</STRONG> on failure, but
64 the single error condition <STRONG>EOVERFLOW</STRONG> associated with
65 extended-level conformance is not yet returned (the XSI
67 SVr3 and early SVr4 curses implementations did not reject
68 function keys; the SVr4.0 documentation claimed that "spe-
69 cial keys" (such as function keys, "home" key, "clear"
70 key, <EM>etc</EM>.) are interpreted" without giving details. It
71 lied. In fact, the `character' value appended to the
72 string by those implementations was predictable but not
73 useful (being, in fact, the low-order eight bits of the
76 The functions <STRONG>getnstr</STRONG>, <STRONG>mvgetnstr</STRONG>, and <STRONG>mvwgetnstr</STRONG> were pre-
77 sent but not documented in SVr4.
81 <H2>SEE ALSO</H2><PRE>
82 <STRONG><A HREF="ncurses.3x.html">curses(3X)</A></STRONG>, <STRONG><A HREF="curs_getch.3x.html">curs_getch(3X)</A></STRONG>.