Re: safe shut-down



My app must be close with the close button (x button).
If the user launches the app in a console, he can close it
with crtl+c and this produces a non-safe shut-down.
How can I avoid this?

#include <signal.h>

/* to disable crtl+c */
signal (SIGINT, SIG_IGN);

/* to enable crtl+c */
signal(SIGINT, SIG_DFL);

This is AINSI C code, so it should really work everywhere.

Carlos




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]