...
Code Block | ||
---|---|---|
| ||
#include <stdio.h> #include <stdlib.h> void exit1(void) { /* ...cleanup code... */ return; } void exit2(void) { if (/* condition */) { /* ...more cleanup code... */ exit(0); } return; } int main(void) { if (atexit(exit1); atexit(exit2); != 0) { /* Handle Error */ } if (atexit(exit2) != 0) { /* Handle Error */ } /* ...program code... */ exit(0); } |
...
Code Block | ||
---|---|---|
| ||
#include <stdio.h> #include <stdlib.h> void exit1(void) { /* ...cleanup code... */ return; } void exit2(void) { if (/* condition */) { /* ...more cleanup code... */ } return; } int main(void) { if (atexit(exit1); atexit(exit2); != 0) { /* Handle Error */ } if (atexit(exit2) != 0) { /* Handle Error */ } /* ...program code... */ exit(0); } |
...