Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>atexit() register terminating function</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 atexit()                Register Terminating Function

 #include   <stdlib.h>

 int        atexit(func);
 void       *func;                       Pointer to function to call on exit

    atexit() registers the address of a function ('func') in the list of
    functions to be called when the calling process terminates normally
    (either by returning from main() or by calling exit()).  atexit() can
    register up to 32 functions, which are executed in a "last-in,
    first-out" order.

    Returns:    0 if successful; a nonzero value if 32 functions are
                already registered.

      Notes:    _exit() and abort() do not execute functions registered
                with atexit().

                The functions registered with atexit() cannot have
                parameters.

 Portability:   ANSI

   -------------------------------- Example ---------------------------------

    The following program prints out "good-bye".

           #include <stdlib.h>

           dash()
           {
               printf("-");
           }

           bye()
           {
               printf("bye\n");
           }

           main()
           {
               atexit(bye);
               atexit(dash);
               printf("Good");
           }


See Also: onexit() exit() _exit() abort()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson