I have a program run on a console, and I need to save progress when the user closes the console. How to do it?
Example:
void func()
{
if (UserClosesTheConsole()) // Dunno how to detect
SaveProgess();
}
int main()
{
std::thread t(func);
}
Any solution (doesn’t need to be cross-platform) is welcome.