FILE* fp1;
FILE* fp2;
int fileIndex;
if((fp1=fopen("fileOnePath","r"))!=NULL && fp2=fopen("fileTwoPath","r"))!=NULL)
{
while(!feof(fp1) && !feof(fp2))
{
char ch1 = fgetc(fp1);
char ch2 = fgetc(fp2);
if(ch1 != ch2)
{
printf("something different happen in: %d byte\n",fileIndex)
printf("different content: %c(%d) != %c(%d)\n",ch1,ch1,ch2,ch2)
}
fileIndex++;
}
第一个打印的是不同的位置单位是:位
第二个打印的不同的内容,如:1(49) != 2(50),括号里是不同字符的ASCII码,为了显示一些不可识别的字符
取消
评论