C examples for stdlib.h:abort
function
<cstdlib> <stdlib.h>
Abort current process
void abort (void); void abort() noexcept;
none
none.
In the following code, if main.cpp does not exist, a message is printed and abort is called.
#include <stdio.h> #include <stdlib.h> int main ()/*from w w w . jav a 2s. com*/ { FILE * pFile; pFile= fopen ("nonExist.cpp","r"); if (pFile == NULL) { fputs ("error opening file\n",stderr); abort(); } fclose (pFile); return 0; }