Ends program execution immediately
#include <stdlib.h>
void abort( void );
The abort( ) function terminates execution of a program by raising the SIGABRT signal. For a "clean" program termination, use the exit( ) function. abort( ) does not flush the buffers of open files or call any cleanup functions that you have installed using atexit( ). The abort( ) function generally prints a message such as:
Abnormal program termination
on the stderr stream. In Unix, aborting a program also produces a core dump.
Example
struct record { long id;
int data[256];
struct record *next;
};
/* ... */
struct record *new = (struct record *)malloc( sizeof(struct record) );
if ( new == NULL ) // Check whether malloc failed!
{
fprintf( stderr, "%s: out of memory!", _ _func_ _ );
abort( );
}
else /* ... */
See Also
_Exit( ), exit( ), atexit( ), raise( )
|