register function to be called at termination
cc . . . -lc
The atexit function is passed the
address of a function (func)
to be called when the program terminates normally. Successive calls
to atexit create a register of functions that are executed ``last
in, first out.'' No more than 32 functions can be registered with
atexit. The functions passed to atexit cannot
atexit returns zero on success or -1 on failure.
int fn1( ), fn2( ), fn3( ), fn4( );
printf("This is executed first.\n");
int fn1( )
int fn2( )
int fn3( )
int fn4( )
This is executed first.
This is executed next.
This program pushes four functions onto the stack of functions to
be executed when atexit is called. When the program exits, these
programs are executed on a last-in, first-out basis.
atexit is conformant with:
ANSI X3.159-1989 Programming Language -- C
© 2003 System Services (S)
SCO OpenServer Release 5.0.7 -- 11 February 2003