ncurses

Statically link ncurses to program

戏子无情 提交于 2019-11-28 12:12:28
I'm having some problems statically linking ncurses to one of my programs Here's a really simple sample program: #include<ncurses.h> int main(){ initscr(); printw("Hello world\n"); refresh(); getch(); endwin(); return 0; } When I compile it with gcc -static -lncurses hello_curses.c -o curses I get these errors: /tmp/ccwHJ6o1.o: In function `main': curses_hello.c:(.text+0x5): undefined reference to `initscr' curses_hello.c:(.text+0x14): undefined reference to `printw' curses_hello.c:(.text+0x1b): undefined reference to `stdscr' curses_hello.c:(.text+0x20): undefined reference to `wrefresh'

Display wchar_t using ncurses

浪子不回头ぞ 提交于 2019-11-28 11:48:39
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 charMap _charMap[2] = { {0,0,9474} {29, 29, 9474} }; initscr(); setlocale(LC_ALL, ""); for (y = 0 ; y <

ncurses in urxvt does not print repeating characters

女生的网名这么多〃 提交于 2019-11-28 11:47:54
问题 Running an ncurses program in urxvt squeezes repeating characters in strings. For example I expect "--------" but I get "-" . I have written a short program that reproduces the problem. The code is below. I have verified that the output is as correct when using xterm rather than urxvt . This is the first time I am working with ncurses, however, the sample program is as simple as they come. Therefore, I don't think it is likely that the problem is with how I'm using ncurses. This is also

Why has no one written a threadsafe branch of the ncurses library?

ぃ、小莉子 提交于 2019-11-28 11:40:31
问题 NCurses appears to be a popular library. One of its weaknesses is, that it is not threadsafe. It should not be hard to wrap shared ressources in mutexes. Is there a specific reason, why noone has started a threadsafe branch? (Legal issues, introducing a platform dependency, ...) Edit: I do not mean the use_screen or use_window functions. These apparently require the user to change his NCurses-based code. It should be possible to add a mutex to the shared resources within the NCurses itself,

NCurses Refresh

♀尐吖头ヾ 提交于 2019-11-28 11:05:28
I have a small ncurse program I'm running, but the output doesn't seem to show up unless I stick the wrefresh() in a while loop. Is there some buffering going on or something? I tried other refresh functions in the library and fflush with stddout (which I don't think makes sense, but worth a try), but nothing seems to work. A second small question: to make getch() non-blocking we need to call nodelay(win,TRUE) , right? void main() { initscr(); start_color(); init_pair(1,COLOR_YELLOW,COLOR_CYAN); WINDOW *win = newwin(10,10,1,1); wbkgd(win,COLOR_PAIR(1)); wprintw(win,"Hello, World."); wrefresh

Resize terminal and scrolling problem with ncurses

旧城冷巷雨未停 提交于 2019-11-28 10:19:32
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,0); win2=newwin(6,18,2,2); scrollok(win2,1); wrefresh(win); wrefresh(win); for(i=0;i<15;i++){ c=wgetch

How to install R-packages not in the conda repositories?

僤鯓⒐⒋嵵緔 提交于 2019-11-28 10:17:09
I am using Anaconda to manage my R-installation. It works great for packages available in the R-channels provided by Anaconda, but I am having troubles installing packages not contained in the Anaconda repos. I have tried a few different approaches, all listed below together with their error output. 1. install.packages('rafalib') Suggested to work here conda - How to install R packages that are not available in "R-essentials"? . My .libPaths() points to '/home/user/anaconda2/lib/R/library' . Out: --- Please select a CRAN mirror for use in this session --- Error in download.file(url, destfile =

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

这一生的挚爱 提交于 2019-11-28 10:07:36
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((ch = getch()) != EOF); endwin(); return 0; } Why does the above code still clearr the screen, and what

How Do ncurses et. al. Work?

两盒软妹~` 提交于 2019-11-28 09:50:34
There are several libraries like ncurses that assist in making command-line GUIs. Simply put, how do they work? My first thought was that ncurses intercepts all keyboard input, and draws each "frame" by outputting it line-by-line normally. Closer inspection, however, reveals that each new frame overwrites the previous one. How does it modify lines that have already been outputted? Furthermore, how does it handle color? EDIT: The same question applies to anything with a "fancy" interface, like vim and emacs . Craig Text terminals have command sequences that do things like move the cursor to a

Resizing glitch with Ncurses?

回眸只為那壹抹淺笑 提交于 2019-11-28 09:18:36
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(); mvprintw(0, 0, "COLS = %d, LINES = %d", COLS, LINES); for (int i = 0; i < COLS; i++) mvaddch(1, i, '*');