endwin() does not terminate your program; something else should do it.
This program works correctly on my system (Ubuntu 11.04, g ++ 4.5.2):
#include <curses.h> #include <unistd.h> #include <iostream> int main() { initscr(); mvaddstr(10, 10, "Hello, world"); refresh(); sleep(4); endwin(); std::cout << "DONE\n"; }
It clears the screen, prints โHello, worldโ at the expected position, sleeps for 4 seconds, then restores the screen and prints โDONEโ.
As mentioned in the comments, if boxmessage() uses ncurses, it will not work after endwin() called.
Try adding the code after endwin() , which creates and writes to the file, just to make sure your program doesn't die right there.
Update (almost 16 months later), citing OP's latest comment:
Ok, I found a mistake. Just because I made a series of buttons, I made the case: x part, and I just did not write an integer that calls the function correctly. Thanks for the help!
source share