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();
}
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster