C Reference function abort()
This function of stdlib will abort the current process.
Usage of abort():
void abort ( void );
The function aborts the process with an abnormal program termination.
The function abort will generate a signal SIGABRT. This signal will by default causes the program to terminate.
Parameters:
None.
Return value:
None.
Source code example of abort():
#include<stdio.h>
#include<stdlib.h>
int main ()
{
FILE * ptr_file;
ptr_file= fopen ("somefile.txt","r");
if (ptr_file == NULL)
{
fputs ("error opening file\n",stderr);
abort();
}
fclose (ptr_file);
return 0;
}
This entry was posted in C Reference stdlib.h Functions.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.
Tweet This! or use
to share this post with others.