ncurses

Handle escape sequences with ncurses? Does printf handle escape sequences?

瘦欲@ 提交于 2019-12-24 00:43:06
问题 My program read some text data from network, something like: Hello \033[1;34mworld\033[0m and bla bla bla!!!\n" . When program output this string using prinf, the word "world" is blue. But when I'm using ncurses interface with wprintw or addch, I see the original string with escape sequences. Does it mean that printf handle escape sequences or not? What is the best way handle escape sequences with ncurses? 回答1: No, your terminal handles the escape sequences. The phenomenon you're seeing comes

Static linking with Boost and ncurses

夙愿已清 提交于 2019-12-23 23:27:22
问题 I am in the process of making a basic role-playing game. I want to include the Boost libraries statically so that the people who run my game do not need to have them. I researched and looked-up that all you have to do is add -static to the command-line compile, so my command is like this: $ g++ -static -o karthas *.o -lncurses -lmenu -lboost_system -lboost_filesystem But apparently the -static is affecting ncurses. I am getting a whole bunch of errors, most of which are undefined reference to

How to get a brightwhite color in ncurses?

梦想的初衷 提交于 2019-12-23 09:36:22
问题 How to init a color pair with light grey background, and bright white foregraound? init_pair(number, COLOR_WHITE, COLOR_WHITE) creates a color pair with light grey foreground and backround, but I need foreground to be really white. I tried combining COLOR_WHITE with A_BLINK (through bitwise OR) but that doesn't work. Ncurses howto's/examples/documentaion couldn't help me either. 回答1: You need to set the bold attribute. Call attron(A_BOLD) before you write and attroff(A_BOLD) after. 回答2: I had

ncurses transparent console background

社会主义新天地 提交于 2019-12-23 07:28:46
问题 My console has transparency enabled, when I run other ncurses apps, I see the the background stays transparent. I'm trying to make my app keep the transparency and not apply a dark black opaque background. This is what I'm doing so far start_color(); init_pair(1, COLOR_GREEN, COLOR_BLACK); attron(COLOR_PAIR(1)); mvprintw(10,10, "Hello"); refresh(); attroff(COLOR_PAIR(1)); Any ideas? Thanks 回答1: If your application calls use_default_colors, ncurses (and NetBSD curses) provide an extension

Writing a command line shell with C; trying to use ncurses/C for the first time

守給你的承諾、 提交于 2019-12-23 04:22:56
问题 I'm working on a class project in which I must write a command line shell with the following requirements: The shell must able to read buffered input Buffer should be 64 characters Error conditions should be handled Exceeded buffer size Interruptions (when a signal arrives) – see the man page for read() Invalid input (unparsable characters, blank lines, etc) Any other error that may be encountered. Shell must have a history of at least 20 items, and the history must not be of a static size.

Ncurses and realtime (implemented in C, unix)

南楼画角 提交于 2019-12-22 06:58:49
问题 I am trying to implement a game using ncurses in C. I have to show the current time (the time must update each second) and my while loop looks like this while(1) { clk = time(NULL); cur_time = localtime(&clk); mvprintw(0,1,"%d %d %d",cur_time->tm_hour,cur_time->tm_min,cur_time->tm_sec); int key = getch() //other stuff } My problem is that the time will refresh only when I press a key. Is it a way to make the time refresh without the need of pressing a key (and to implement this in the same

Change Terminal Font Size with C++

时间秒杀一切 提交于 2019-12-22 04:43:12
问题 I'm doing a small project for fun in C++ (in Ubuntu 11.04) and the program is text-based (all in the Gnome terminal). I'm using the ncurses library to change the font color, but I also want to print different sized text to the terminal, and can't figure out how to do that with ncurses. Is there a way to do this (perhaps with ncurses, or with a different library)? Ideally, I'd want it to be terminal-independent,, but if it's a solution that only works in Gnome, or only works in Ubuntu, or some

Change Terminal Font Size with C++

隐身守侯 提交于 2019-12-22 04:43:05
问题 I'm doing a small project for fun in C++ (in Ubuntu 11.04) and the program is text-based (all in the Gnome terminal). I'm using the ncurses library to change the font color, but I also want to print different sized text to the terminal, and can't figure out how to do that with ncurses. Is there a way to do this (perhaps with ncurses, or with a different library)? Ideally, I'd want it to be terminal-independent,, but if it's a solution that only works in Gnome, or only works in Ubuntu, or some

Using ncurses to capture mouse clicks on a console application

雨燕双飞 提交于 2019-12-22 04:05:15
问题 I'm making a console application for unix platforms, and I'm using the curses (or ncurses) library to handle keyboard and mouse input. The problem is that I've found very little documentation on how exactly to use it for that, appart from this page and this one, which don't have very detailed examples. I've managed to capture the left click, but I can't get it to work for the right click because the options menu for the terminal emulator appears at the cursor location, but the event is not

ncurses api with the D Programming Language

≯℡__Kan透↙ 提交于 2019-12-22 03:55:46
问题 I am trying to teach myself AI using neural networks. Long story short, I wanted to create a simple graphic that would display what is happening in my program using ncurses. The tutorial that I am using is found here. I was under the impression that D was compatible with C and I could theoretically call C functions relatively easily. I find that not to be the case. I am a relatively novice programmer, so even the simplistic explanations are a little above my head. I found this here. D is