Get text on display with ncurses

Is there a way to return the characters output to a variable on ncurses?

let's say that I:

printw("test");

then I want to be able to:

somefunc(strbuffer);
printf("%s",strbuffer); // test

I need a function to return all the characters on the screen to a variable, scr_dump is approaching, but the output format is unreadable.

+3
source share
2 answers

If you place material on the screen using curses functions (for example, addch, mvaddch, addstr), you can use inchstr) and related functions to read characters from the screen (retrieve them with the return value AND using A_CHARTEXT).

, printf non-curses ( , ), .

Curses , inchstr .

+9

. printw ( ), 8- (ASCII, POSIX, ISO-8859-1), inch inchstr :

instr . .

, (, UTF-8), . inch inchstr:

- , X/Open Curses . getcchar ( ) .

A () , :

, char ( chtype), UTF-8 -. Linux, wchar_t Unicode. wchar_t, (-) (UTF-8).

, ncurses, curses, , , ncurses, X/Open Curses , ( ). ncurses addch ( char - ) , UTF-8, . X/Open Curses . .

, 2010 , ncurses 'scr_dump format , "".

0

Source: https://habr.com/ru/post/1750575/


All Articles