Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 2 | .\" Copyright 2018-2023,2024 Thomas E. Dickey * |
| 3 | .\" Copyright 2002-2012,2017 Free Software Foundation, Inc. * |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 4 | .\" * |
| 5 | .\" Permission is hereby granted, free of charge, to any person obtaining a * |
| 6 | .\" copy of this software and associated documentation files (the * |
| 7 | .\" "Software"), to deal in the Software without restriction, including * |
| 8 | .\" without limitation the rights to use, copy, modify, merge, publish, * |
| 9 | .\" distribute, distribute with modifications, sublicense, and/or sell * |
| 10 | .\" copies of the Software, and to permit persons to whom the Software is * |
| 11 | .\" furnished to do so, subject to the following conditions: * |
| 12 | .\" * |
| 13 | .\" The above copyright notice and this permission notice shall be included * |
| 14 | .\" in all copies or substantial portions of the Software. * |
| 15 | .\" * |
| 16 | .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * |
| 17 | .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * |
| 18 | .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * |
| 19 | .\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * |
| 20 | .\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * |
| 21 | .\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * |
| 22 | .\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. * |
| 23 | .\" * |
| 24 | .\" Except as contained in this notice, the name(s) of the above copyright * |
| 25 | .\" holders shall not be used in advertising or otherwise to promote the * |
| 26 | .\" sale, use or other dealings in this Software without prior written * |
| 27 | .\" authorization. * |
| 28 | .\"*************************************************************************** |
| 29 | .\" |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 30 | .\" $Id: curs_inwstr.3x,v 1.41 2024/04/20 21:20:07 tom Exp $ |
| 31 | .TH curs_inwstr 3X 2024-04-20 "ncurses @NCURSES_MAJOR@.@NCURSES_MINOR@" "Library calls" |
| 32 | .ie \n(.g \{\ |
| 33 | .ds `` \(lq |
| 34 | .ds '' \(rq |
| 35 | .\} |
| 36 | .el \{\ |
| 37 | .ie t .ds `` `` |
| 38 | .el .ds `` "" |
| 39 | .ie t .ds '' '' |
| 40 | .el .ds '' "" |
| 41 | .\} |
| 42 | .de bP |
| 43 | .ie n .IP \(bu 4 |
| 44 | .el .IP \(bu 2 |
| 45 | .. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 46 | .SH NAME |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 47 | \fB\%inwstr\fP, |
| 48 | \fB\%innwstr\fP, |
| 49 | \fB\%winwstr\fP, |
| 50 | \fB\%winnwstr\fP, |
| 51 | \fB\%mvinwstr\fP, |
| 52 | \fB\%mvinnwstr\fP, |
| 53 | \fB\%mvwinwstr\fP, |
| 54 | \fB\%mvwinnwstr\fP \- |
| 55 | get a wide-character string from a \fIcurses\fR window |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 56 | .SH SYNOPSIS |
| 57 | .nf |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 58 | \fB#include <curses.h> |
| 59 | .PP |
| 60 | \fBint inwstr(wchar_t *\fIwstr\fP); |
| 61 | \fBint innwstr(wchar_t *\fIwstr\fP, int \fIn\fP); |
| 62 | \fBint winwstr(WINDOW *\fIwin\fP, wchar_t *\fIwstr\fP); |
| 63 | \fBint winnwstr(WINDOW *\fIwin\fP, wchar_t *\fIwstr\fP, int \fIn\fP); |
| 64 | .PP |
| 65 | \fBint mvinwstr(int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP); |
| 66 | \fBint mvinnwstr(int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP, int \fIn\fP); |
| 67 | \fBint mvwinwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP); |
| 68 | \fBint mvwinnwstr(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP, wchar_t *\fIwstr\fP, int \fIn\fP); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 69 | .fi |
| 70 | .SH DESCRIPTION |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 71 | These routines return a string of \fBwchar_t\fP wide characters in \fIwstr\fP, |
| 72 | starting at the current cursor position in the named window. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 73 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 74 | The four functions with \fIn\fP as the last argument return |
| 75 | a leading substring at most \fIn\fP characters long |
| 76 | (exclusive of the trailing NUL). |
| 77 | Transfer stops at the end of the current line, or when \fIn\fP characters have |
| 78 | been stored at the location referenced by \fIwstr\fP. |
| 79 | .PP |
| 80 | If the size \fIn\fP is not large enough to store a complete complex character, |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 81 | an error is generated. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 82 | .SH RETURN VALUE |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 83 | All routines return |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 84 | \fBERR\fP |
| 85 | upon failure. |
| 86 | Upon |
| 87 | successful completion, the *\fBinwstr\fP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 88 | routines return |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 89 | \fBOK\fP, and the *\fBinnwstr\fP |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 90 | routines return the |
| 91 | number of characters read into the string. |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 92 | .PP |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 93 | X/Open defines no error conditions. |
| 94 | This implementation returns an error |
| 95 | .bP |
| 96 | if the \fIwin\fP parameter is null or |
| 97 | .bP |
| 98 | if the \fIwstr\fP parameter is null, or |
| 99 | .bP |
| 100 | if no characters could be read. |
| 101 | .PP |
| 102 | Functions prefixed with \*(``mv\*('' first perform cursor movement and |
| 103 | fail if the position |
| 104 | .RI ( y , |
| 105 | .IR x ) |
| 106 | is outside the window boundaries. |
| 107 | .SH NOTES |
| 108 | All routines except |
| 109 | \fBwinnwstr\fP |
| 110 | may be macros. |
| 111 | .PP |
| 112 | Each cell in the window holds a complex character |
| 113 | (a spacing character and zero or more non-spacing characters) |
| 114 | together with attributes and color. |
| 115 | These functions store only the wide characters, |
| 116 | ignoring attributes and color. |
| 117 | Use \fBin_wchstr\fP to return the complex characters from a window. |
| 118 | .PP |
| 119 | Reading a line that overflows the array pointed to by |
| 120 | \fIwstr\fP |
| 121 | with |
| 122 | \fBinwstr\fP, |
| 123 | \fBmvinwstr\fP, |
| 124 | \fBmvwinwstr\fP |
| 125 | or |
| 126 | \fBwinwstr\fP |
| 127 | causes undefined results. |
| 128 | Therefore, the use of |
| 129 | \fBinnwstr\fP, |
| 130 | \fBmvinnwstr\fP, |
| 131 | \fBmvwinnwstr\fP, or |
| 132 | \fBwinnwstr\fP |
| 133 | is recommended. |
| 134 | .SH PORTABILITY |
| 135 | These functions are described in X/Open Curses, Issue 4. |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 136 | .SH SEE ALSO |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 137 | \fB\%curses\fP(3X), |
| 138 | \fB\%curs_inch\fP(3X), |
| 139 | \fB\%curs_inchstr\fP(3X), |
| 140 | \fB\%curs_instr\fP(3X), |
| 141 | \fB\%curs_in_wchstr\fP(3X) |