...
Function | Closes file descriptors | Flushes buffers | Deletees temporary files | Calls functions registered with |
|---|---|---|---|---|
abort() | unspecified | unspecified | unspecified | no |
_exit(status) | yes | unspecified | unspecified | no |
exit(status) | yes | yes | yes | yes |
atexit()
You can use the Standard C atexit() function to customize exit() to perform additional actions at program termination.
For example, calling:
| Code Block | ||
|---|---|---|
| ||
atexit(turn_gizmo_off); |
"registers" the turn_gizmo_off() function so that a subsequent call to exit() will invoke turn_gizmo_off(); as it terminates the program. The C standard says that atexit() should let you register up to 32 functions.
...