]> ncurses.scripts.mit.edu Git - ncurses.git/blob - doc/html/man/curs_inwstr.3x.html
ncurses 6.5 - patch 20240615
[ncurses.git] / doc / html / man / curs_inwstr.3x.html
1 <!--
2   ****************************************************************************
3   * Copyright 2018-2023,2024 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_inwstr.3x,v 1.45 2024/06/08 21:19:18 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_inwstr 3x 2024-06-08 ncurses 6.5 Library calls</TITLE>
38 <link rel="author" href="mailto:bug-ncurses@gnu.org">
39
40 </HEAD>
41 <BODY>
42 <H1 class="no-header">curs_inwstr 3x 2024-06-08 ncurses 6.5 Library calls</H1>
43 <PRE>
44 <STRONG><A HREF="curs_inwstr.3x.html">curs_inwstr(3x)</A></STRONG>                  Library calls                 <STRONG><A HREF="curs_inwstr.3x.html">curs_inwstr(3x)</A></STRONG>
45
46
47
48
49 </PRE><H2><a name="h2-NAME">NAME</a></H2><PRE>
50        <STRONG>inwstr</STRONG>,  <STRONG>innwstr</STRONG>,  <STRONG>winwstr</STRONG>,  <STRONG>winnwstr</STRONG>,  <STRONG>mvinwstr</STRONG>, <STRONG>mvinnwstr</STRONG>, <STRONG>mvwinwstr</STRONG>,
51        <STRONG>mvwinnwstr</STRONG> - get a wide-character string from a <EM>curses</EM> window
52
53
54 </PRE><H2><a name="h2-SYNOPSIS">SYNOPSIS</a></H2><PRE>
55        <STRONG>#include</STRONG> <STRONG>&lt;curses.h&gt;</STRONG>
56
57        <STRONG>int</STRONG> <STRONG>inwstr(wchar_t</STRONG> <STRONG>*</STRONG> <EM>wstr</EM><STRONG>);</STRONG>
58        <STRONG>int</STRONG> <STRONG>winwstr(WINDOW</STRONG> <STRONG>*</STRONG> <EM>win</EM><STRONG>,</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*</STRONG> <EM>wstr</EM><STRONG>);</STRONG>
59        <STRONG>int</STRONG> <STRONG>mvinwstr(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*</STRONG> <EM>wstr</EM><STRONG>);</STRONG>
60        <STRONG>int</STRONG> <STRONG>mvwinwstr(WINDOW</STRONG> <STRONG>*</STRONG> <EM>win</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*</STRONG> <EM>wstr</EM><STRONG>);</STRONG>
61
62        <STRONG>int</STRONG> <STRONG>innwstr(wchar_t</STRONG> <STRONG>*</STRONG> <EM>wstr</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>);</STRONG>
63        <STRONG>int</STRONG> <STRONG>winnwstr(WINDOW</STRONG> <STRONG>*</STRONG> <EM>win</EM><STRONG>,</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*</STRONG> <EM>wstr</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>);</STRONG>
64        <STRONG>int</STRONG> <STRONG>mvinnwstr(int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*</STRONG> <EM>wstr</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>);</STRONG>
65        <STRONG>int</STRONG> <STRONG>mvwinnwstr(WINDOW</STRONG> <STRONG>*</STRONG> <EM>win</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>y</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>x</EM><STRONG>,</STRONG> <STRONG>wchar_t</STRONG> <STRONG>*</STRONG> <EM>wstr</EM><STRONG>,</STRONG> <STRONG>int</STRONG> <EM>n</EM><STRONG>);</STRONG>
66
67
68 </PRE><H2><a name="h2-DESCRIPTION">DESCRIPTION</a></H2><PRE>
69        <STRONG>winwstr</STRONG> extracts a wide-character string  from  a  <EM>curses</EM>  window  <EM>win</EM>,
70        starting  at the cursor and stopping at the end of the line, and stores
71        it in <EM>wstr</EM>, terminating it with a wide null character and omitting  any
72        attributes  and  color pair identifier that <EM>curses</EM> associates with each
73        character.  <STRONG>winnwstr</STRONG> does the same, but copies  at  most  <EM>n</EM>  characters
74        from  <EM>win</EM>.   An  <EM>n</EM>  of  <STRONG>-1</STRONG>  implies  no limit; <STRONG>winnwstr</STRONG> then works like
75        <STRONG>winwstr</STRONG>.  <STRONG><A HREF="ncurses.3x.html">ncurses(3x)</A></STRONG> describes the variants of these functions.
76
77
78 </PRE><H2><a name="h2-RETURN-VALUE">RETURN VALUE</a></H2><PRE>
79        On successful operation, these  functions  return  the  count  of  wide
80        characters  copied  from  <EM>win</EM>  to  <EM>wstr</EM>.  They return <STRONG>ERR</STRONG> upon failure.
81        <STRONG>innwstr</STRONG>, <STRONG>winnwstr</STRONG>,  <STRONG>mvinnwstr</STRONG>,  and  <STRONG>mvwinnwstr</STRONG>  return  <STRONG>ERR</STRONG>  if  <EM>n</EM>  is
82        insufficiently  large  to  store  a  complete  wide  character  string.
83        (Recall that a <EM>curses</EM>  complex  character  can  contain  multiple  wide
84        characters, some of which may be non-spacing.)
85
86        In <EM>ncurses</EM>, these functions return <STRONG>ERR</STRONG> if
87
88        <STRONG>o</STRONG>   <EM>win</EM> is <STRONG>NULL</STRONG> or
89
90        <STRONG>o</STRONG>   <EM>wstr</EM> is <STRONG>NULL</STRONG>.
91
92        Functions  prefixed with "mv" first perform cursor movement and fail if
93        the position (<EM>y</EM>, <EM>x</EM>) is outside the window boundaries.
94
95
96 </PRE><H2><a name="h2-NOTES">NOTES</a></H2><PRE>
97        All of these functions except <STRONG>winnwstr</STRONG> may be implemented as macros.
98
99        Reading a line that overflows the array pointed to by <EM>str</EM> with  <STRONG>inwstr</STRONG>,
100        <STRONG>winwstr</STRONG>,  <STRONG>mvinwstr</STRONG>,  or  <STRONG>mvwinwstr</STRONG>  causes  undefined  results.  Use of
101        <STRONG>innwstr</STRONG>, <STRONG>winnwstr</STRONG>, <STRONG>mvinnwstr</STRONG>, and <STRONG>mvwinnwstr</STRONG> is recommended instead.
102
103
104 </PRE><H2><a name="h2-EXTENSIONS">EXTENSIONS</a></H2><PRE>
105        <STRONG>innwstr</STRONG>, <STRONG>winnwstr</STRONG>, <STRONG>mvinnwstr</STRONG>, and <STRONG>mvwinnwstr</STRONG>'s treatment  of  <STRONG>-1</STRONG>  as  a
106        valid value of <EM>n</EM> is an <EM>ncurses</EM> extension.
107
108
109 </PRE><H2><a name="h2-PORTABILITY">PORTABILITY</a></H2><PRE>
110        Applications employing <EM>ncurses</EM> extensions should condition their use on
111        the visibility of the <STRONG>NCURSES_VERSION</STRONG> preprocessor macro.
112
113        X/Open Curses, Issue 4 describes  these  functions.   It  specifies  no
114        error conditions for them.
115
116        Notwithstanding  the foregoing, X/Open Curses Issues 4 and 7 both state
117        that <STRONG>innwstr</STRONG>, <STRONG>winnwstr</STRONG>, <STRONG>mvinnwstr</STRONG>, and <STRONG>mvwinnwstr</STRONG> "fail  ...  [i]f  the
118        array  is  not  large  enough  to  contain  any  complete  characters".
119        Strictly interpreted, this means  that  a  caller  of  these  functions
120        cannot use their return values to detect truncation of a wide-character
121        string copied from more  than  one  character  cell  in  <EM>win</EM>.   <EM>ncurses</EM>
122        reports any truncation with <STRONG>ERR</STRONG>.
123
124        X/Open  Curses  specifies  <STRONG>inwstr</STRONG>,  <STRONG>winwstr</STRONG>, <STRONG>mvinwstr</STRONG>, and <STRONG>mvwinwstr</STRONG> as
125        returning <STRONG>OK</STRONG> rather than a (wide) character count,  unlike  their  non-
126        wide  counterparts  <STRONG>instr</STRONG>,  <STRONG>winstr</STRONG>,  <STRONG>mvinstr</STRONG>,  and  <STRONG>mvwinstr</STRONG>.   <EM>ncurses</EM>
127        regards this inconsistency as an error in the standard.
128
129
130 </PRE><H2><a name="h2-SEE-ALSO">SEE ALSO</a></H2><PRE>
131        <STRONG><A HREF="curs_instr.3x.html">curs_instr(3x)</A></STRONG> describes comparable functions of the <EM>ncurses</EM> library in
132        its non-wide-character configuration.
133
134        <STRONG><A HREF="ncurses.3x.html">curses(3x)</A></STRONG>, <STRONG><A HREF="curs_in_wch.3x.html">curs_in_wch(3x)</A></STRONG>, <STRONG><A HREF="curs_in_wchstr.3x.html">curs_in_wchstr(3x)</A></STRONG>
135
136
137
138 ncurses 6.5                       2024-06-08                   <STRONG><A HREF="curs_inwstr.3x.html">curs_inwstr(3x)</A></STRONG>
139 </PRE>
140 <div class="nav">
141 <ul>
142 <li><a href="#h2-NAME">NAME</a></li>
143 <li><a href="#h2-SYNOPSIS">SYNOPSIS</a></li>
144 <li><a href="#h2-DESCRIPTION">DESCRIPTION</a></li>
145 <li><a href="#h2-RETURN-VALUE">RETURN VALUE</a></li>
146 <li><a href="#h2-NOTES">NOTES</a></li>
147 <li><a href="#h2-EXTENSIONS">EXTENSIONS</a></li>
148 <li><a href="#h2-PORTABILITY">PORTABILITY</a></li>
149 <li><a href="#h2-SEE-ALSO">SEE ALSO</a></li>
150 </ul>
151 </div>
152 </BODY>
153 </HTML>