Whenever I need a large data output in a console I just use setconsolescreenbuffersize() so I can always scroll back if amount of data exceeds the size of console.
However, when using pdcurses I can't seem to make it so a window remembers its contents. If I set it to be scrollable and try to scroll back I get empty lines. I've looked at WINDOW data structure and haven't found anything resembling data buffer. Do I have to code a buffer for curses window myself?
Here is an example program. It creates a pad, prints numbers from 1 to 100 and after that is supposed to scroll back to number one. However, instead of numbers there is simply nothing.
#include <Windows.h>
#include <curses.h>
int main()
{
WINDOW *w;
int i;
if (initscr() != NULL)
{
if ((w = newpad(25,80)) != NULL)
{
scrollok(w,TRUE);
for (i = 1 ; i <= 100 ; i++)
{
Sleep (50);
wprintw(w,"%d\n",i);
prefresh(w,0,0,0,0,24,79);
}
while (true)
{
Sleep (50);
wscrl (w, -1);
prefresh(w,0,0,0,0,24,79);
}
}
endwin();
}
return 0;
}