c-read和fread返回值

问题描述

SO的好人!

我有一个理论上的问题。 在read()的联机帮助页中,我阅读了以下内容:

   On error,-1 is returned,and errno is set appropriately.  In this
   case,it is left unspecified whether the file position (if any)
   changes.

fread()中,对应的片段如下:

   If an error occurs,or the end of the 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.

我的问题-read()确实可以区分EOF和错误,而fread()却不能呢?

提前谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)