Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo 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 only for declarations
 #include   <stdlib.h>                   Use either <process.h> or <stdlib.h>

 void       abort(void);

    abort() terminates a calling process, prints the message "Abnormal
    program termination" to 'stderr', exits with status code 3, and
    returns control to the parent without flushing stream buffers.

       Returns:     Exit status 3; does not return to the calling 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\n");
                    abort();
               }
           }


See Also: exit() _exit()

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