#include <stdlib.h>
|
int
atexit (void (*function)(void)); |
These functions must not call exit; if it should be necessary to terminate the process while in such a function, the _exit function should be used. (Alternatively, the function may cause abnormal process termination, for example by calling abort
At least 32 functions can always be registered, and more are allowed as long as sufficient memory can be allocated.
#include <stdlib.h> #include <stdio.h> void fun1( void ), fun2( void ), fun3( void ), fun4( void ); int main( void ) { atexit( fun1 ); atexit( fun2 ); atexit( fun3 ); atexit( fun4 ); printf( "Before exiting....\n" ); } void fun1() { printf( " fun1\n " ); } void fun2() { printf( " fun2\n " ); } void fun3() { printf( " fun3\n " ); } void fun4() { printf( " fun4\n " ); }
Output
Before exiting... fun4 fun3 fun2 fun1
[ENOMEM] | |
No memory was available to add the function to the list. The existing list of functions is not modified. | |
© 2005-2007 Nokia |