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>
    void exit( int status );

Description:
    The exit function causes normal program termination to occur.

    First, all functions registered by the  atexit function are called in
    the reverse order of their registration.  Next, all open files are
    flushed and closed, and all files created by the  tmpfile function are
    removed.  Finally, the return status is made available to the parent
    process.  Only the low order byte of status is available on DOS systems.
     The status value is typically set to 0 to indicate successful
    termination and set to some other value to indicate an error.

Returns:
    The exit function does not return to its caller.

See Also:
    abort, atexit, _exit, onexit

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

    void main( int argc, char *argv[] )
      {
        FILE *fp;

        if( argc <= 1 ) {
          fprintf( stderr, "Missing argument\n" );
          exit( EXIT_FAILURE );
        }
        fp = fopen( argv[1], "r" );
        if( fp == NULL ) {
          fprintf( stderr, "Unable to open '%s'\n", argv[1] );
          exit( EXIT_FAILURE );
        }
        fclose( fp );
        exit( EXIT_SUCCESS );
      }

Classification:
    ANSI

Systems:
    All

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