Reputation: 91
I have got problem with printing extended ascii in terminal using wprintw function. This program prints letters instead squares. I was trying to change my locales but without effect. What should I change in my system to print it correctly?
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <unistd.h>
#include <locale.h>
#include <wchar.h>
int main(void)
{
setlocale(LC_ALL, "");
initscr();
WINDOW *game_window;
game_window=newwin(40,40,1,1);
wrefresh(game_window);
while (TRUE) {
wclear(game_window);
wprintw(game_window, "██████████████████████");
wrefresh(game_window);
sleep(3);
break;
}
endwin();
return 0;
}
I am working On Debian Jessie 10 and these are my locale:
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Upvotes: 0
Views: 186
Reputation: 91
Ok, I find the solution, when compiling the program you should use this command:
gcc main.c -o main -lncursesw
Instead this:
gcc main.c -o main -lncurses
Upvotes: 1