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 - <b>abort() abort process and return error</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
abort()                  Abort Process and Return Error

 #include   <process.h>                  Required for declarations only
 #include   <stdlib.h>                   Use either <process.h> or <stdlib.h>

 void       abort(void);

    abort() terminates the calling process.  The message "Abnormal
    program termination" is printed to 'stderr'. Control is returned to
    the parent process.  Stream buffers are not flushed.

    Returns:    abort() does not return to the calling process.  It
                returns an exit status of 3 to the parent process.

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

    The following statements terminate the program if the file
    "testfile.dat" cannot be opened:

           #include <process.h>    /* for 'abort' (also in <stdlib.h>) */
           #include <stdio.h>      /* for 'fprintf' */

           main()
           {
               FILE *f;

               if ((f = fopen("testfile.dat", "r")) == NULL) {
                    fprintf(stderr, "can't open testfile.dat");
                    abort();
               }
           }

See Also: exit() _exit() signal()

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