What exactly is the effect of Ctrl-C on C++ Win32 console applications?

前端 未结 3 1298
耶瑟儿~
耶瑟儿~ 2021-01-17 10:57
  1. Is it possible to handle this event in some way?
  2. What happens in terms of stack unwinding and deallocation of static/global objects?
3条回答
  •  再見小時候
    2021-01-17 11:27

    Ctrl-C in console application will generate a signal. The default handler of this signal calls ExitProcess to terminate the application. You can override this behaviour by setting your own handler functions for the signal using SetConsoleCtrlHandler function.

提交回复
热议问题