I have a small ncurse program I'm running, but the output doesn't seem to show up unless I stick the wrefresh()
in a while loop.
Is there some buffering going on or something? I tried other refresh
functions in the library and fflush
with stddout
(which I don't think makes sense, but worth a try), but nothing seems to work.
A second small question: to make getch()
non-blocking we need to call nodelay(win,TRUE)
, right?
void main()
{
initscr();
start_color();
init_pair(1,COLOR_YELLOW,COLOR_CYAN);
WINDOW *win = newwin(10,10,1,1);
wbkgd(win,COLOR_PAIR(1));
wprintw(win,"Hello, World.");
wrefresh(win);
getch();
delwin(win);
endwin();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…