I am using the ncurses
library 开发者_开发问答to show some funny output on the screen, but in the middle of the program I need to temporarily exit ncurses
mode. I call endwin()
, after which my program should be able to use printf()
to show a menu to the user. Unluckily, my program was unable to show the menu. I tried using fflush()
after printf()
, and only then is it able to show the menu on the screen.
Can anyone tell me why, after I call endwin()
, the terminal can't return to normal and I'm unable to use printf()
?
Use def_prog_mode
prior to endwin
to save state.
After returning, do: reset_prog_mode
and then refresh
.
Your original screen will be shown.
Yes, after using printf you have to do: fflush(stdout).
精彩评论