bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: add_wch() prints garbage


From: Igor Liferenko
Subject: Re: add_wch() prints garbage
Date: Fri, 14 Apr 2017 14:06:52 +0700

Hi,

It turns out that I passed incorrect argument to add_wch() - that is
why it did not work as expected. The following example works fine. Now
cchar_t* is passed to add_wch() instead of wchar_t* typecasted to
cchar_t*.

#include <ncursesw/curses.h>
#include <wchar.h>
#include <locale.h>
#include <string.h>

int main(void)
{
  setlocale(LC_CTYPE, "C.UTF-8");
  initscr();
  cchar_t my_cchar;
  memset(&my_cchar, 0, sizeof(my_cchar));
  my_cchar.chars[0] = L'ф';
  my_cchar.chars[1] = L'\0';
  add_wch(&my_cchar);
  refresh();
  getch();
  endwin();
  return 0;
}

Regards,
Igor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]