2 .\"***************************************************************************
3 .\" Copyright 2018-2022,2023 Thomas E. Dickey *
4 .\" Copyright 1998-2010,2017 Free Software Foundation, Inc. *
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: *
14 .\" The above copyright notice and this permission notice shall be included *
15 .\" in all copies or substantial portions of the Software. *
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. *
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 *
29 .\"***************************************************************************
31 .\" $Id: curs_inch.3x,v 1.40 2023/10/07 21:19:07 tom Exp $
32 .TH curs_inch 3X 2023-10-07 "ncurses 6.4" "Library calls"
53 get a \fIcurses\fR character from a window
56 \fB#include <curses.h>
59 \fBchtype winch(WINDOW *\fIwin\fP);
61 \fBchtype mvinch(int \fIy\fP, int \fIx\fP);
62 \fBchtype mvwinch(WINDOW *\fIwin\fP, int \fIy\fP, int \fIx\fP);
65 These routines return the character, of type \fBchtype\fP, at the current
66 position in the named window.
67 If any attributes are set for that position,
68 their values are OR'ed into the value returned.
70 \fB<curses.h>\fP can be used with the \fB&\fP (logical AND) operator to
71 extract the character or attributes alone.
74 The following bit-masks may be AND-ed with characters returned by \fBwinch\fP.
78 \fBA_CHARTEXT\fP Bit-mask to extract character
79 \fBA_ATTRIBUTES\fP Bit-mask to extract attributes
80 \fBA_COLOR\fP Bit-mask to extract color-pair field information
83 Functions with a \*(``mv\*('' prefix first perform a cursor movement using
84 \fBwmove\fP, and return an error if the position is outside the window,
85 or if the window pointer is null.
87 The \fBwinch\fP function does not return an error if the window contains
88 characters larger than 8-bits (255).
89 Only the low-order 8 bits of the character are used by \fBwinch\fP.
91 Note that all of these routines may be macros.
93 These functions are described in the XSI Curses standard, Issue 4.
95 Very old systems (before standardization) provide a different function
98 The \fBwinch\fP function was part of the original BSD curses library,
99 which stored a 7-bit character combined with the \fIstandout\fP attribute.
101 In BSD curses, \fBwinch\fP returned only the character (as an integer)
102 with the \fIstandout\fP attribute removed.
104 System V curses added support for several video attributes which
105 could be combined with characters in the window.
107 Reflecting this improvement, the function was altered to return the
108 character combined with all video attributes in a \fBchtype\fP value.
110 X/Open Curses does not specify
111 the size and layout of attributes, color and character values in
112 \fBchtype\fP; it is implementation-dependent.
113 This implementation uses 8 bits for character values.
114 An application using more bits, e.g., a Unicode value,
115 should use the wide-character equivalents to these functions.
119 gives an overview of the \fB\%WINDOW\fP and \fB\%chtype\fP data types.
121 \fB\%curs_attr\fP(3X)
122 goes into more detail, pointing out portability problems and
123 constraints on the use of \fB\%chtype\fP for returning window
126 \fB\%curs_in_wch\fP(3X)
127 describes comparable functions for the wide-character (ncursesw)