ncurses

Display wchar_t using ncurses

做~自己de王妃 提交于 2019-11-27 06:38:25
问题 i'm currently working on a C++ project in which I need to display some extended characters (wchar_t). The main problem is that, even if it works fine in C (using wprintf ), it doesn't work in c++ using mvwaddwstr or waddwstr . Of course, i've set the locale like that: setlocale(LC_ALL, ""); , and nothing is displayed. Does someone got this problem before, or has an idea about that? Thanks. Here is the code: struct charMap { int x; int y; wchar_t value }; int i, x, y; wchar_t str[2]; struct

Resize terminal and scrolling problem with ncurses

十年热恋 提交于 2019-11-27 03:37:41
问题 I'm programming in C using ncurses libraries (it's the first time) and I've two problems. I'm on ubuntu with the default terminal (gnome terminal). 1) I need to resize the terminal. I used resizeter() and resize_term(), but they fail. 2) I use scrollok() function and the problem is that I lose scrolled lines (when I get back with wscrl(), there are blank lines). #include <ncurses.h> int main() { WINDOW *win, *win2; int i; char c; initscr(); cbreak(); noecho(); win=newwin(8,20,1,1); box(win,0

How do I use getch from curses without clearing the screen?

狂风中的少年 提交于 2019-11-27 03:24:40
问题 I'm learning to program in C and want to be able to type characters into the terminal while my code is running without pressing return . My program works, however when I call initscr() , the screen is cleared - even after calling filter() . The documentation for filter suggests it should disable clearing - however this is not the case for me. #include <stdio.h> #include <curses.h> #include <term.h> int main(void) { int ch; filter(); initscr(); cbreak(); noecho(); keypad(stdscr, TRUE); while(

Resizing glitch with Ncurses?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 02:55:55
问题 I'm writing an ncurses program and am trying to make it respond correctly to terminal resizing. While I can read the terminal dimensions correctly in my program, ncurses doesn't seem to deal with new dimensions correctly. Here's a (somewhat lengthy) sample program: #include <ncurses.h> #include <string.h> #include <signal.h> #include <sys/ioctl.h> void handle_winch(int sig){ struct winsize w; ioctl(0, TIOCGWINSZ, &w); COLS = w.ws_col; LINES = w.ws_row; wresize(stdscr, LINES, COLS); clear();

Receiving key press and key release events in Linux terminal applications?

时间秒杀一切 提交于 2019-11-27 02:08:22
问题 I would like to write a simple C program that will perform different actions based on both "key down" and "key up" events. This program will be run from inside rxvt. What library or mechanism should I use to access both key presses and releases? Is it true that reading /dev/tty will only provide key releases? Is this also true for termcap, terminfo, ncurses, and slang? Is there a way to achieve this from within a terminal application? 回答1: The following links may be of some assistance in

curses-like library for cross-platform console app in python

☆樱花仙子☆ 提交于 2019-11-27 01:07:01
问题 I'm looking into developing a console application in python which should be able to run under Windows as well as Linux. For this, I'd really like to use a high-level console library like curses. However, as far as I know, curses is not available on Windows. What other options do I have? Unfortunately, using cygwin under Windows is not an option... Thanks for your help! 回答1: There is a wcurses. I've never tried it but it may meet your needs. It sounds like it doesn't have full curses

Adding Unicode/UTF8 chars to a ncurses display in C

爱⌒轻易说出口 提交于 2019-11-26 23:20:51
问题 I'm attempting to add wchar_t Unicode characters to an ncurses display in C. I have an array: wchar_t characters[]={L'\uE030', L'\uE029'}; // containing 2 thai letters, for example And I later try to add a wchar_t from the array to the ncurses display with: add_wch(characters[0]); To provide a bit more info, doing this with ASCII works ok, using: char characters[]={'A', 'B'}; // and later... addch(characters[0]); To setup the locale, I add the include... #include <locale.h> // in main()

Ncurses and Qt Interoperability

你。 提交于 2019-11-26 22:59:25
Having a Qt and ncurses based application, what is the best way to refresh the screen every second, while waiting for user input? (e.g. show the clock and get user input). I need the best compromise between CPU usage and application responsiveness. To be more specific with the question, how to get user input and still use QTimer and the signal-slot mechanism? When using the code below, the timers doen't work. nodelay(stdscr,true); while(1) { sleep(1); getch(); processInput(); } Use QSocketNotifier to be notified of things being available on stdin . Call nonblocking getch() in a loop until no

Undefined reference to `initscr' Ncurses

倖福魔咒の 提交于 2019-11-26 22:41:15
I'm trying to compile my project and I use the lib ncurse. And I've got some errors when compiler links files. Here is my flags line in Makefile: -W -Wall -Werror -Wextra -lncurses I've included ncurses.h Some layouts : prompt$> dpkg -S curses.h libslang2-dev:amd64: /usr/include/slcurses.h libncurses5-dev: /usr/include/ncurses.h libncurses5-dev: /usr/include/curses.h prompt$> dpkg -L libncurses5-dev | grep .so /usr/lib/x86_64-linux-gnu/libncurses.so /usr/lib/x86_64-linux-gnu/libcurses.so /usr/lib/x86_64-linux-gnu/libmenu.so /usr/lib/x86_64-linux-gnu/libform.so /usr/lib/x86_64-linux-gnu

getch and putchar not working without return

本小妞迷上赌 提交于 2019-11-26 21:58:09
问题 I have been trying to get getch to work in another program with no success. So I have made the most basic program I can using getch the way I want it to work in the main program. I have researched the need for noecho , cbreak , initscr and nodelay , I have also tried using newscr() but to no success. The problem I am having is that the chars aren't being printed to the screen till I hit "enter", when they should be put to the screen every loop. Why is this happening? Also the cursor doesn't