User:Vcdhanesh/My Sandbox

C programming standard library function. It is used in programming process or environment to stop the program or process abnormally. It deletes buffers and closes all open files before ending the program.

Abort (C Standard Library)
' abort' is standard C library function ,used to terminate program 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 useful.

Description
This standard C library function causes abnormal termination of program.Then it returns control to host environment.Apparantly this function behaves as exit function. It deletes buffers and closes open files before ending the program, all open streams are closed and flushed.

Header file & Syntax


void abort(void);

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.