Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main(int argc, char **argv) {
- if (argc < 2) {
- fprintf(stderr, "Usage: %s FILE1 FILE2\n", argv[0]);
- exit(EXIT_FAILURE);
- }
- FILE *f1 = fopen(argv[1], "r");
- FILE *f2 = fopen(argv[2], "r");
- int c1, c2;
- while (1) {
- c1 = fgetc(f1);
- c2 = fgetc(f2);
- if (c1 != c2) {
- puts("differ");
- exit(EXIT_SUCCESS);
- }
- if (c1 == EOF) break;
- }
- puts("same");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement