ncurses

Two Windows - one modified by thread random output

牧云@^-^@ 提交于 2019-12-02 07:13:17
问题 I'm trying to write code where the screen is divided into two windows and one of them is modified by a different thread, but output seems to be very random. Could anyone help? Upper piece of console should be modified by main, and lower by thread k . #include <stdio.h> #include <ncurses.h> #include <unistd.h> #include <thread> #define WIDTH 30 #define HEIGHT 10 int startx = 0; int starty = 0; void kupa (int score_size, int parent_x, int parent_y) { int i = 0; WINDOW *dupa = newwin(score_size,

Two Windows - one modified by thread random output

本秂侑毒 提交于 2019-12-02 06:23:06
I'm trying to write code where the screen is divided into two windows and one of them is modified by a different thread, but output seems to be very random. Could anyone help? Upper piece of console should be modified by main, and lower by thread k . #include <stdio.h> #include <ncurses.h> #include <unistd.h> #include <thread> #define WIDTH 30 #define HEIGHT 10 int startx = 0; int starty = 0; void kupa (int score_size, int parent_x, int parent_y) { int i = 0; WINDOW *dupa = newwin(score_size, parent_x, parent_y - score_size, 0); while(true) { i++; mvwprintw(dupa, 0 , 0, "You chose choice %d

Using Python subprocess.call() to launch an ncurses process

送分小仙女□ 提交于 2019-12-02 05:39:35
I'm trying to call ct-ng ( http://crosstool-ng.org/ ) from a SCons SConstruct script, so basically from Python. using the following method: ret = subprocess.call(["/mnt/build/pw_build/crosstool-ng/bin/ct-ng menuconfig"], env=env_cross,shell=True) crosstool-ng uses ncurses to present the user with a menu: Unfortunately when trying to navigate the menus I get: Using cat to display the sequences when using the arrow keys I see: :/mnt/build$ cat > /dev/null ^[OA^[OD^[OB^[OC^[OA^[OB^[OD^[OC^[OA^[OB It seems like something is possibly stripping the escape characters from the sequence. When I call

Different nCurses behaviours with different terminals

限于喜欢 提交于 2019-12-02 04:33:51
问题 I obtain two different behaviours using different terminals, this is my code: (use ncurses) (initscr) (curs_set 0) (noecho) (start_color) (define win (newwin 20 50 1 1)) (wclear win) (box win 0 0) (for-each (lambda (y) (for-each (lambda (x) (mvwaddch win y x #\. )) (iota 49))) (iota 19)) (wrefresh win) (wgetch win) (endwin) The code is written in Chicken Scheme but it's easily readable by anyone who knows nCurses. I think my problem doesn't concern the library because it's a simple wrapper

How to read an incomplete form field ncurses C++

落花浮王杯 提交于 2019-12-02 03:56:25
问题 I have a code that read a form field using ncurses (C++), but i can't show a value when the form field isn't full typed. #include <form.h> #include <curses.h> #include <stdlib.h> #include <string.h> #include <time.h> WINDOW *chatwin, *entrywin; FIELD *field[1]; FORM *fo; void quit(void) { int i; unpost_form(fo); free_form(fo); free_field(field[0]); free_field(field[1]); delwin(chatwin); endwin(); } int main(void) { int xsize, ysize; int charinput, i; char inputstring[200]; char ttime[10];

Different nCurses behaviours with different terminals

南笙酒味 提交于 2019-12-02 01:29:06
I obtain two different behaviours using different terminals, this is my code: (use ncurses) (initscr) (curs_set 0) (noecho) (start_color) (define win (newwin 20 50 1 1)) (wclear win) (box win 0 0) (for-each (lambda (y) (for-each (lambda (x) (mvwaddch win y x #\. )) (iota 49))) (iota 19)) (wrefresh win) (wgetch win) (endwin) The code is written in Chicken Scheme but it's easily readable by anyone who knows nCurses. I think my problem doesn't concern the library because it's a simple wrapper which calls the C functions. However, I get the correct behaviour (a boxed window) if I use xterm, uxterm

Add curses library to Visual Studio C++?

 ̄綄美尐妖づ 提交于 2019-12-01 22:45:58
问题 I'm trying to use the curses library on Microsoft's Visual Studio C++. I downloaded ncurses-5.9.tar.gz from http://www.gnu.org/software/ncurses/, and I unzipped the file. However, I can't find a .lib or a .dll file in the package. Without the .lib file, I don't know how to link my code in Visual Studio to the header files in the ncurses package. Do I need to move the header files to somewhere in my project? Thanks for the help! 回答1: In a nutshell: you want PDCurses. What you did is not how to

Scrolling in C with ncurses pad

浪尽此生 提交于 2019-12-01 21:42:06
I'm trying to get a window in ncurses where i write the result of a mysql-query. But the query returns more lines than i have in my terminal. So I tried to create a pad, so that i can scroll through the results. But the problem is, that there is no pad visible on my terminal. I just simplified the code, but it's still not working for me: #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <ncurses.h> #include <mysql.h> #include <my_global.h> WINDOW *pad; MYSQL *con; static int mrow, mcol; static char *host, *user, *pass; void quit(void) { // close MySQL

get the text in the display with ncurses

佐手、 提交于 2019-12-01 21:24:15
Is there any way to get back the characters outputted into a variable on ncurses ? let's say I do: printw("test"); then I want to be able to: somefunc(strbuffer); printf("%s",strbuffer); // test I need a function to get back all characters on the screen into a variable, scr_dump get's close but the output format is unreadable.. Craig If you put stuff on the screen using curses functions (e.g. addch, mvaddch, addstr) you can use inchstr ) and related functions to read the characters from the screen (extracting them with AND'ing the returned value with A_CHARTEXT ). However, if you use printf or

Add curses library to Visual Studio C++?

十年热恋 提交于 2019-12-01 20:37:05
I'm trying to use the curses library on Microsoft's Visual Studio C++. I downloaded ncurses-5.9.tar.gz from http://www.gnu.org/software/ncurses/ , and I unzipped the file. However, I can't find a .lib or a .dll file in the package. Without the .lib file, I don't know how to link my code in Visual Studio to the header files in the ncurses package. Do I need to move the header files to somewhere in my project? Thanks for the help! Kuba Ober In a nutshell: you want PDCurses . What you did is not how to use curses at all. What you have downloaded is source code, there are no binaries there at all