get the text in the display with ncurses

前端 未结 2 1718
清酒与你
清酒与你 2021-01-13 11:42

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 t

2条回答
  •  天涯浪人
    2021-01-13 12:03

    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 any other non-curses method of puting text on the screen (including a system call to another program that uses curses) you will not be able to read the content of the screen.

    Curses maintains the current screen contents internally and the inchstr functions use the internal representation of the screen to find the current contents.

提交回复
热议问题