12-20-05 10:57 PM
I have a program which is spewing junk to std::cout from all over the
place. I would like to be able to catch a keypress without blocking,
and so I have used ncurses to do so. Unfortunately using the wgetch()
function seems to cause a screen clear on each read, which results in
flicker in the application. clearok(w,FALSE) does not seem to work.
My code is:
WINDOW* w = initscr();
nodelay(w,true);
bool q(false);
while(!q)
{
std::cout << "Print junk!\n";
clearok(w,FALSE);
wrefresh(w);
int kk=wgetch(w);
endwin();
switch(kk)
{
case 'q': q=true;
break;
case -1:
break;
default:
std::cout << "A ket!\n";
}
sleep(1);
}
Is there any way to eliminate the flicker? Is the above code
incorrect?
Thank you for any/all help.
don
[ Post a follow-up to this message ]
|