问题
I am trying to read a char from my ncurses terminal with mvin_wch() which returns a cchar_t, I know this is a struct with stuff like color information and a wchar_t. I can't seem to find any information about this cchar_t. I just wan't to know what it's members are named. I don't get why such an important part of the ncursesw library isn't documented anywhere.
回答1:
If you have to know, read curses.h
, but as noted, you are expected to manipulate cchar_t
using the library calls, e.g., setcchar and getcchar. Each implementation of curses uses different details for this structure. The ncurses manual page tells all that you need to know about its content:
cchar_t
corresponds to chtype. However it is a structure, because
more data is stored than can fit into an integer. The
characters are large enough to require a full integer
value - and there may be more than one character per cell.
The video attributes and color are stored in separate
fields of the structure.
Each cell (row and column) in a WINDOW is stored as a
cchar_t.
For the video attributes, pay attention to the PORTABILITY section of the attributes manual page.
In the comments, one pointed to X/Open Curses page on datatypes. The description of cchar_t
therein is inaccurate:
cchar_t
References a string of wide characters
(it is not a reference to a string, but a complete "wide" character in itself).
来源:https://stackoverflow.com/questions/52248221/ncurses-cant-find-any-documentation-on-cchar-t