Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    onexit_t onexit( onexit_t func )

Description:
    The onexit function is passed the address of function func to be called
    when the program terminates normally.  Successive calls to onexit create
    a list of functions that will be executed on a "last-in, first-out"
    basis.  No more than 32 functions can be registered with the onexit
    function.

    The functions have no parameters and do not return values.

    NOTE:  The onexit function is not an ANSI function.  The ANSI standard
    function  atexit does the same thing that onexit does and should be used
    instead of onexit where ANSI portability is concerned.

Returns:
    The onexit function returns func if the registration succeeds, NULL if
    it fails.

See Also:
    abort, atexit, exit, _exit

Example:
    #include <stdio.h>
    #include <stdlib.h>

    void main()
      {
        void func1(void), func2(void), func3(void);

        onexit( func1 );
        onexit( func2 );
        onexit( func3 );
        printf( "Do this first.\n" );
      }

    void func1(void) { printf( "last.\n" ); }
    void func2(void) { printf( "this " ); }
    void func3(void) { printf( "Do " ); }

    produces the following:

    Do this first.
    Do this last.

Classification:
    WATCOM

Systems:
    All

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