I’ve been trying to make an ncurses program that will end the ncurses mode at a certain point, and resume in normal terminal mode, but still keeping the program running.
Is it possible? endwin(); ends the program.
Here is my code (don’t worry about the functions, I made them before):
clear();
refresh();
endwin();
boxmessage("STEP 1");
consolewrite("Removing Popularity Contest...");
std::vector<std::string> removepak;
removepak.push_back("popularity-contest");
removepackages(removepak);
endwin()isn’t terminating your program; something else must be doing so.This program works correctly on my system (Ubuntu 11.04, g++ 4.5.2):
It clears the screen, prints “Hello, world” at the expected position, sleeps for 4 seconds, then restores the screen and prints “DONE”.
As was mentioned in comments, if
boxmessage()uses ncurses, it’s not going to work after you callendwin().Try adding some code after
endwin()that creates and writes to a file, just to verify that your program doesn’t die right there.Update (nearly 16 months later), quoting the OP’s most recent comment: