请帮我。我无法读取二进制文件。该文件的长度是198944,但我的代码读取374。我尝试使用fread、ifstream、WinAPI ReadFile。这是读取文件的函数:
std::string ReadThisFile(std::string aPath) {
FILE *inputstream = fopen(aPath.c_str(),"rb");
long size;
size_t result;
fseek(inputstream,0,SEEK_END);
size = ftell(inputstream);
rewind(inputstream);
char *buff = new char [size];
result = fread (buff,1,size,inputstream);
std::string ret=buff;
fclose(inputstream);
delete[]buff;
return ret;
}
需要任何帮助,谢谢!