#include #include #include #define MAXLEN 1000 void flcmp(FILE *fp1, FILE *fp2); int main(int argc, char *argv[]) { FILE *fp1, *fp2; if (argc != 3) { fprintf(stderr, "Usgae: %s file1 file2\n", *argv); return 1; } else if (!(fp1 = fopen(argv[1], "r")) || !(fp2 = fopen(argv[2], "r"))) { fprintf(stderr, "%s: unable to read files\n", *argv); return 1; } else { flcmp(fp1, fp2); return 0; } } void flcmp(FILE *fp1, FILE *fp2) { char l1[MAXLEN], l2[MAXLEN]; while (fgets(l1, MAXLEN, fp1) && fgets(l2, MAXLEN, fp2)) { if (strcmp(l1, l2)) { printf(">>> %s", l1); printf("<<< %s", l2); break; } } }