]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_get_wstr.3x.html
ncurses 6.2 - patch 20210619
[ncurses.git] / doc / html / man / curs_get_wstr.3x.html
1 <!--
2   ****************************************************************************
3   * Copyright 2018-2019,2020 Thomas E. Dickey                                *
4   * Copyright 2002-2012,2017 Free Software Foundation, Inc.                  *
5   *                                                                          *
6   * Permission is hereby granted, free of charge, to any person obtaining a  *
7   * copy of this software and associated documentation files (the            *
8   * "Software"), to deal in the Software without restriction, including      *
9   * without limitation the rights to use, copy, modify, merge, publish,      *
10   * distribute, distribute with modifications, sublicense, and/or sell       *
11   * copies of the Software, and to permit persons to whom the Software is    *
12   * furnished to do so, subject to the following conditions:                 *
13   *                                                                          *
14   * The above copyright notice and this permission notice shall be included  *
15   * in all copies or substantial portions of the Software.                   *
16   *                                                                          *
17   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18   * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20   * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21   * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22   * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23   * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24   *                                                                          *
25   * Except as contained in this notice, the name(s) of the above copyright   *
26   * holders shall not be used in advertising or otherwise to promote the     *
27   * sale, use or other dealings in this Software without prior written       *
28   * authorization.                                                           *
29   ****************************************************************************
30   * @Id: curs_get_wstr.3x,v 1.21 2020/10/17 23:17:24 tom Exp @
31 -->
32 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
33 <HTML>
34 <HEAD>
35 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
36 <meta name="generator" content="Manpage converted by man2html - see https://invisible-island.net/scripts/readme.html#others_scripts">
37 <TITLE>curs_get_wstr 3X</TITLE>
38 <link rel="author" href="mailto:bug-ncurses@gnu.org">
39 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_get_wstr 3X</H1>
43 <PRE>
44 <B><A HREF="curs_get_wstr.3X.html">curs_get_wstr(3X)</A></B>                                            <B><A HREF="curs_get_wstr.3X.html">curs_get_wstr(3X)</A></B>
45
46
47
48
49 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
50        <B>get_wstr</B>, <B>getn_wstr</B>, <B>wget_wstr</B>, <B>wgetn_wstr</B>, <B>mvget_wstr</B>, <B>mvgetn_wstr</B>,
51        <B>mvwget_wstr</B>, <B>mvwgetn_wstr</B> - get an array of wide characters from a
52        curses terminal keyboard
53
54
55 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
56        <B>#include</B> <B>&lt;curses.h&gt;</B>
57
58        <B>int</B> <B>get_wstr(wint_t</B> <B>*</B><I>wstr</I><B>);</B>
59        <B>int</B> <B>getn_wstr(wint_t</B> <B>*</B><I>wstr</I><B>,</B> <B>int</B> <I>n</I><B>);</B>
60        <B>int</B> <B>wget_wstr(WINDOW</B> <B>*</B><I>win</I><B>,</B> <B>wint_t</B> <B>*</B><I>wstr</I><B>);</B>
61        <B>int</B> <B>wgetn_wstr(WINDOW</B> <B>*</B><I>win</I><B>,</B> <B>wint_t</B> <B>*</B><I>wstr</I><B>,</B> <B>int</B> <I>n</I><B>);</B>
62
63        <B>int</B> <B>mvget_wstr(int</B> <I>y</I><B>,</B> <B>int</B> <I>x</I><B>,</B> <B>wint_t</B> <B>*</B><I>wstr</I><B>);</B>
64        <B>int</B> <B>mvgetn_wstr(int</B> <I>y</I><B>,</B> <B>int</B> <I>x</I><B>,</B> <B>wint_t</B> <B>*</B><I>wstr</I><B>,</B> <B>int</B> <I>n</I><B>);</B>
65        <B>int</B> <B>mvwget_wstr(WINDOW</B> <B>*</B><I>win</I><B>,</B> <B>int</B> <I>y</I><B>,</B> <B>int</B> <I>x</I><B>,</B> <B>wint_t</B> <B>*</B><I>wstr</I><B>);</B>
66        <B>int</B> <B>mvwgetn_wstr(WINDOW</B> <B>*</B><I>win</I><B>,</B> <B>int</B> <I>y</I><B>,</B> <B>int</B> <I>x</I><B>,</B> <B>wint_t</B> <B>*</B><I>wstr</I><B>,</B> <B>int</B> <I>n</I><B>);</B>
67
68
69 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
70        The  effect  of  <B>get_wstr</B> is as though a series of calls to <B><A HREF="curs_get_wch.3X.html">get_wch(3X)</A></B>
71        were made, until a newline, other end-of-line, or end-of-file condition
72        is  processed.  An end-of-file condition is represented by <B>WEOF</B>, as de-
73        fined in <B>&lt;wchar.h&gt;</B>.  The newline and end-of-line conditions are  repre-
74        sented  by  the  <B>\n</B>  <B>wchar_t</B>  value.   In all instances, the end of the
75        string is terminated by a null <B>wchar_t</B>.  The routine  places  resulting
76        values in the area pointed to by <I>wstr</I>.
77
78        The  user's  erase and kill characters are interpreted.  If keypad mode
79        is on for the window, <B>KEY_LEFT</B> and <B>KEY_BACKSPACE</B>  are  both  considered
80        equivalent to the user's kill character.
81
82        Characters  input  are  echoed  only  if <B>echo</B> is currently on.  In that
83        case, backspace is echoed as deletion of the previous character  (typi-
84        cally a left motion).
85
86        The effect of <B>wget_wstr</B> is as though a series of calls to <B>wget_wch</B> were
87        made.
88
89        The effect of <B>mvget_wstr</B> is as though a call to <B>move</B> and then a  series
90        of calls to <B>get_wch</B> were made.
91
92        The  effect  of <B>mvwget_wstr</B> is as though a call to <B>wmove</B> and then a se-
93        ries of calls to <B>wget_wch</B> were made.
94
95        The <B>getn_wstr</B>, <B>mvgetn_wstr</B>, <B>mvwgetn_wstr</B>, and <B>wgetn_wstr</B> functions  are
96        identical to the <B>get_wstr</B>, <B>mvget_wstr</B>, <B>mvwget_wstr</B>, and <B>wget_wstr</B> func-
97        tions, respectively, except that the <B>*n_*</B> versions read at most <I>n</I> char-
98        acters, letting the application prevent overflow of the input buffer.
99
100
101 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
102        Using  <B>get_wstr</B>,  <B>mvget_wstr</B>,  <B>mvwget_wstr</B>, or <B>wget_wstr</B> to read a line
103        that overflows the array pointed to by <B>wstr</B> causes  undefined  results.
104        The use of <B>getn_wstr</B>, <B>mvgetn_wstr</B>, <B>mvwgetn_wstr</B>, or <B>wgetn_wstr</B>, respec-
105        tively, is recommended.
106
107        These functions cannot return <B>KEY_</B> values because there is  no  way  to
108        distinguish a <B>KEY_</B> value from a valid <B>wchar_t</B> value.
109
110        All of these routines except <B>wgetn_wstr</B> may be macros.
111
112
113 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
114        All  of  these  functions return <B>OK</B> upon successful completion.  Other-
115        wise, they return <B>ERR</B>.
116
117        Functions using a window parameter return an error if it is null.
118
119               <B>wgetn_wstr</B>
120                    returns an error if the associated call to <B>wget_wch</B> failed.
121
122        Functions with a "mv" prefix first  perform  a  cursor  movement  using
123        <B>wmove</B>, and return an error if the position is outside the window, or if
124        the window pointer is null.
125
126
127 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
128        These functions are described in The Single Unix Specification, Version
129        2.   No  error conditions are defined.  This implementation returns <B>ERR</B>
130        if the window pointer is null, or if the lower-level <B>wget_wch</B> call  re-
131        turns  an <B>ERR</B>.  In the latter case, an <B>ERR</B> return without other data is
132        treated as an end-of-file condition, and the returned array contains  a
133        <B>WEOF</B> followed by a null <B>wchar_t</B>.
134
135        X/Open curses documented these functions to pass an array of <B>wchar_t</B> in
136        1997, but that was an error because of this part of the description:
137
138               The effect of <I>get</I><B>_</B><I>wstr()</I> is as  though  a  series  of  calls  to
139               <I>get</I><B>_</B><I>wch()</I>  were  made,  until  a  newline character, end-of-line
140               character, or end-of-file character is processed.
141
142        The latter function  <I>get</I><B>_</B><I>wch()</I>  can  return  a  negative  value,  while
143        <B>wchar_t</B>  is  a  unsigned type.  All of the vendors implement this using
144        <B>wint_t</B>, following the standard.
145
146        X/Open Curses, Issue 7 (2009) is unclear regarding whether  the  termi-
147        nating <I>null</I> <B>wchar_t</B> value is counted in the length parameter <I>n</I>.  X/Open
148        Curses, Issue 7 revised the corresponding description  of  <B>wgetnstr</B>  to
149        address this issue.  The unrevised description of <B>wget_nwstr</B> can be in-
150        terpreted either way.  This implementation counts the terminator in the
151        length.
152
153        X/Open  Curses  does  not specify what happens if the length <I>n</I> is nega-
154        tive.
155
156        <B>o</B>   For analogy with <B>wgetnstr</B>, ncurses  6.2  uses  a  limit  (based  on
157            <B>LINE_MAX</B>).
158
159        <B>o</B>   Some  other  implementations (such as Solaris xcurses) do the same,
160            while others (PDCurses) do not allow this.
161
162        <B>o</B>   NetBSD 7 curses imitates ncurses 6.1 in this regard, treating a  <B>-1</B>
163            as an indefinite number of characters.
164
165
166 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
167        Functions: <B><A HREF="curses.3X.html">curses(3X)</A></B>, <B><A HREF="curs_get_wch.3X.html">curs_get_wch(3X)</A></B>, <B><A HREF="curs_getstr.3X.html">curs_getstr(3X)</A></B>.
168
169
170
171                                                              <B><A HREF="curs_get_wstr.3X.html">curs_get_wstr(3X)</A></B>
172 </PRE>
173 <div class="nav">
174 <ul>
175 <li><a href="#h2-NAME">NAME</a></li>
176 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
177 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
178 <li><a href="#h2-NOTES">NOTES</a></li>
179 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
180 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
181 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
182 </ul>
183 </div>
184 </BODY>
185 </HTML>