fread crash 查找
windows11系统上
char* buff = NULL;
std::FILE* file;
std::string hashValue = "";
do {
buff = (char*)malloc(1024);
if (!buff) {
printf("malloc memory failed");
break;
}
file = std::fopen(filePath, "rb");
if (!file) {
printf("open file failed %s", filePath);
break;
}
size_t len, result;
while (1) {
if ((len = std::fread(buff, sizeof(char), 1024, file)) <= 0) {
break;
}
hasher.add(&buff[0], len);
if ((result = std::fseek(file, 0, SEEK_CUR)) !=
0) {
break;
}
}
fread crash 有老哥帮忙看看是什么问题