Print Unicode characters in C, using ncurses

前端 未结 3 954
醉梦人生
醉梦人生 2021-01-03 04:23

I have to draw a box in C, using ncurses;

First, I have defined some values for simplicity:

#define RB \"\\e(0\\x6a\\e(B\"  (ASCII 188,Right bottom,          


        
3条回答
  •  暖寄归人
    2021-01-03 04:56

    ncurses defines the values ACS_HLINE, ACS_VLINE, ACS_ULCORNER, ACS_URCORNER, ACS_LLCORNER and ACS_LRCORNER. You can use those constants in addch and friends, which should result in your seeing the expected box characters. (There's lots more ACS characters; you'll find a complete list in man addch.)

    ncurses needs to know what it is drawing because it needs to know exactly where the cursor is all the time. Outputting console control sequences is not a good idea; if ncurses knows how to handle the sequence, it has its own abstraction for the feature and you should use that abstraction. The ACS ("alternate character set") defines are one of those abstractions.

提交回复
热议问题