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>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 process that calls it and prints the message
    "Abnormal program termination" to 'stderr'.  raise(SIGABRT) is called
    which terminates the calling process with exit code 3 (abnormal
    termination) and returns control to the parent process.  abort() does
    not flush stream buffers, or do atexit() or onexit() processing.

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

 Compatibility: The Microsoft C Version 4.0 runtime library did not call
                raise(SIGABRT).

   -------------------------------- 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: exec...() exit() _exit() raise() signal() spawn...()

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