1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
/* exit example */
#include <stdio.h> /* printf, fopen */
#include <stdlib.h> /* exit, EXIT_FAILURE */
int main ()
{
FILE * pFile;
pFile = fopen ("myfile.txt","r");
if (pFile==NULL)
{
printf ("Error opening file");
exit (EXIT_FAILURE);
}
else
{
/* file operations here */
}
return 0;
}
|