更新时间:2022-06-02 22:39:52
我没有发现任何严重的错误.但是你应该使用
I did not see anything serious wrong. But you should use
int fd = open(sFilePath, O_RDONLY | O_BINARY, 0);
确保文件以二进制模式打开,因为默认的Windows fmode
是O_TEXT
.
在二进制模式下,然后read应该返回iBytesToRead
,而不仅仅是在文件结尾之前.
to ensure that the file is opened in binary mode, because the default Windows fmode
is O_TEXT
.
With binary mode, read should then return iBytesToRead
while not just before the end of file.