* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * FILE I/O 1 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #include #include #define MAXLEN 1000 int main() { char tline[MAXLEN]; /* A line of text */ FILE *fptr = fopen ("sillyfile.txt","r"); if (fptr == 0) { printf("Error opening data file. Exiting.\n"); fflush(stdout); return -1; } /* check if it's open or at EOF */ while (fgets (tline, MAXLEN, fptr) != NULL) { printf ("%s",tline); // Print it } fclose (fptr); return 0; }