abort


abort

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( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net