Abort current process returning error code: how to use abort : Exit Abort « Development « C / ANSI-C






Abort current process returning error code: how to use abort



#include <stdio.h>
#include <stdlib.h>

int main () {

  FILE *file;
  
  file= fopen ("my.txt","r");
  
  if (file == NULL) {
       printf ("error reading file\n");
       abort();
  }

  fclose (file);
  return 0;
}

           
       








Related examples in the same category

1.Assign function which is called when exit
2. Specifies a function to be executed at exit: how to use atexit
3. Terminate calling process: how to use exit