User:Vcdhanesh/sandbox

C programming standard library function .It is used in programming process or environment to stop the program or process abnormally.This function is required in the program when wrong condition gets encountered in program execution then to come out of process this function is used.

Introduction
It deletes buffers and closes all open files before ending the program. The function abort terminates the current program. Depending on the implementation, the return from the function can indicate a canceled (e.g. you used the signal function to catch SIGABRT) or failed abort. SIGABRT is sent by the process to itself when it calls the abort libc function, defined in cstdlib. The SIGABRT signal can be caught, but it cannot be blocked; if the signal handler returns then all open streams are closed and flushed and the program terminates (dumping core if appropriate), then it returns control to host environment.This means that the abort call never returns. Because of this characteristic, it is often used to signal fatal conditions in support libraries, situations where the current operation cannot be completed but the main program can perform cleanup before exiting. It is also used if an assertion fails.

Header files & Syntax

 * 1) include

void abort( void );
 * 1) include 

Return Value
This function does not return any value i.e. it is of void datatype.

Thread safety
It is one of the thread safe functions from standard c library.i.e. function can be called by different threads without any problem.

Example
This example tests for successful opening of the file myfile. If an error occurs, an error message is printed, and the program ends with a call to the abort function.

System code for UNIX

 * Related topics: assert - atexit - exit