来自fifo文件的彩色输入字符串在ncuses终端中没有彩色。
C代码中的:
if ( (mainwin = initscr()) == NULL ) {
printf("Error initialising ncurses.\n"); return 1;
}
termwin = subwin(mainwin, LINES-5, COLS, 2, 0);
while(... read the file) {
waddstr(termwin, p);
wrefresh(termwin);
}
输出视觉字符串:
^[[0;33;6m38701^[[0m
在ncurses中设置终端以校正ANSI颜色转换?
程序打印到fifo使用:
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_GREEN "\x1b[32m"
#define ANSI_COLOR_YELLOW "\x1b[33m"
#define ANSI_COLOR_BLUE "\x1b[34m"
#define ANSI_COLOR_MAGENTA "\x1b[35m"
#define ANSI_COLOR_CYAN "\x1b[36m"