#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv){
	FILE *fd1 = fopen("test1.txt", "r");
	FILE *fd2 = fopen("test2.txt", "r");
	if (fd1 == NULL || fd2 == NULL){
		printf("Error while opening file!\n");
		return 0;
	}

	fseek(fd1,0,SEEK_END);
	fseek(fd2,0,SEEK_END);

	long size1 = ftell(fd1);
	long size2 = ftell(fd2);

	if (size1 != size2){
		printf("The files are not the same!\n");
		return 0;
	}

	char *a;
	char *b;

	a = (char *)malloc(size1);
	b = (char *)malloc(size2);

	fseek(fd1,0,SEEK_SET);
	fseek(fd2,0,SEEK_SET);

	fread(a,size1,1,fd1);
	fread(b,size2,1,fd2);

	int i;
	for(i=0;i<size1;i++){
		if (a[i] != b[i]){
			printf("different files!\n");
			return 0;
		}
	}

	printf("Identical files!\n");

	fclose(fd1);
	fclose(fd2);
	free(a);
	free(b);

	return 0;
}





