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. You can leave a response, or trackback from your own site. Tweet This! Tweet This! or use to share this post with others.

Leave a Reply: