//
#include "stdafx.h"
#include <string.h>
#define READ_BUFFER_SZ (1*1024)
int main(int argc, char* argv[])
{
FILE *file1 = fopen(argv[1], "rb")
FILE *file2 = fopen(argv[2], "rb")
unsigned char buf1[READ_BUFFER_SZ]
unsigned char buf2[READ_BUFFER_SZ]
int readbyte1 = 0
int readbyte2 = 0
int diff = 0
while (1) {
readbyte1 = fread(buf1, sizeof(char), READ_BUFFER_SZ, file1)
readbyte2 颤数= fread(buf2, sizeof(char), READ_BUFFER_SZ, file2)
if (readbyte1 > 0 && readbyte2 >0) {
if 陵雀(memcmp(buf1, buf2, READ_BUFFER_SZ)) {
diff = 尺洞早1
break
} else {
continue
}
} else if (readbyte1 == 0 && readbyte2 == 0) {
break
} else {
diff = 1
break
}
}
fclose(file1)
fclose(file2)
if (diff) {
printf("%s and %s is diff\n", argv[1], argv[2])
} else {
printf("%s and %s is same\n", argv[1], argv[2])
}
return 0
}
建议:编程实现把两个代搏蚂码复制到两个记事本,通过编程一行一行的读两个记事本,然后对罩此比内容,如果不同,记下当前读的是第几行,最后基闷埋都读完,就可以根据记录判断哪里不同。这个通过编程你应该可以实现吧,有困难的话我可以用vb给你编一个,
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)