I\'m attempting to add wchar_t Unicode characters to an ncurses display in C.
I have an array:
wchar_t characters[]={L\'\\uE030\', L\'\\uE029\'}; //
cchar_t
is defined as:
typedef struct {
attr_t attr;
wchar_t chars[CCHARW_MAX];
} cchar_t;
so you might try:
int add_wchar(int c)
{
cchar_t t = {
0, // .attr
{c, 0} // not sure how .chars works, so best guess
};
return add_wch(t);
}
not at all tested, but should work.
This is not 2 characters:
wchar_t characters[]={L"\uE030", L"\uE029"};
You're trying to initialize wchar_t
(integer) values with pointers, which should result in an error from the compiler. Either use:
wchar_t characters[]={L'\uE030', L'\uE029'};
or
wchar_t characters[]=L"\uE030\uE029";
Did you define _XOPEN_SOURCE_EXTENDED
before including the ncurses header?
The wide character support is handled by ncursesw. Depending on your distro, ncurses may or may not point there (seemingly not in yours).
Try using -lncursesw
instead of -lncurses
.
Also, for the locale, try calling setlocale(LC_ALL, "")