tags:

views:

26

answers:

1

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..

A: 

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.

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.

Craig
thank you, that's exactly what I was searching for.
Anon