#include #include int main() { FILE *fp1, *fp2; int c1, c2, pos = 1; if((fp1 = fopen("output3.txt", "r")) == NULL){ fprintf(stderr, "Failed to open: output3.txt\n"); exit(1); } if((fp2 = fopen("output3_sample.txt", "r")) == NULL){ fprintf(stderr, "Failed to open: output3_sample.txt\n"); fclose(fp1); exit(2); } while(1){ c1 = fgetc(fp1); c2 = fgetc(fp2); if(c1 != c2){ printf("Two files are different at %d byte.\n", pos); break; } if(c1 == EOF){ printf("Two files are identical.\n"); break; } pos++; } fclose(fp1); fclose(fp2); return 0; }