Advertisement

iOS 比较两个文件内容 MD5摘要和直接比较

阅读量:

对两个文件内容进行直接对比

NSString *path = [[NSBundle mainBundle] bundlePath];

NSString *filePath1 = [path stringByAppendingPathComponent:@"3-g.txt"];

NSString *filePath2 = [path stringByAppendingPathComponent:@"4-g.txt"];

// NSString* pathfilePath1 = [[NSBundle mainBundle] pathForResource:@"3-g" ofType:@"txt"];

// -(BOOL)contentsEqualAtPath:path andPath:path2

通过MD5摘要实现比较

NSString *md5str1 = [self md5WithFilePath:filePath1];

NSString *md5str2 = [self md5WithFilePath:filePath2];

if ([md5str1 isEqualToString:md5str2])

- (NSString *)md5WithFilePath:(NSString *)p

全部评论 (0)

还没有任何评论哟~