I want my program to do something before it exists when the user presses the close (X) key on the command prompt. Is it possible? If so, how can I do that? Thanks!
P.S.: I'm on Windows
I want my program to do something before it exists when the user presses the close (X) key on the command prompt. Is it possible? If so, how can I do that? Thanks!
P.S.: I'm on Windows
Last edited by samus250; 10-28-2008 at 06:09 PM.
You can try registering a function with atexit() (I don't know whether clsoing the window calls exit or not).
You can't use signal in windows?
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Thanks tabstop. atexit() seems to work fine and it does what I need.