You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
引用下面这段话:
RETURN VALUE
fread and fwrite return the number of items successfully read or written (i.e., not the number of
characters). If an error occurs, or the end-of-file is reached, the return value is a short item
count (or zero).
fread does not distinguish between end-of-file and error, and callers must use feof(3) and ferror(3)
to determine which occurred.
The text was updated successfully, but these errors were encountered:
int ret = fread(data, size, 1, file_);
if (size == 0 || ret == 0) return false;
if (ret == -1) {}
上面是你的filesystem.cc的代码,这段代码有错误,fread不会返回-1,当返回0的时候应该用feof,ferror来检测是什么原因导致返回的数目比1少,发生错误到关闭
引用下面这段话:
RETURN VALUE
fread and fwrite return the number of items successfully read or written (i.e., not the number of
characters). If an error occurs, or the end-of-file is reached, the return value is a short item
count (or zero).
The text was updated successfully, but these errors were encountered: