如果我仅读取文件,是否需要检查fclose()的返回状态?
|
相关:fclose返回值检查
尽管在写入文件时检查返回值
fclose()
很重要(以防刷新操作失败),但是在读取文件时是否有必要这样做?
FILE *f = fopen(path, \"r\");
if (f == NULL)
return 0;
/* Do something with the file... */
if (fclose(f) != 0) {
/* Error closing a file we successfully read. */
return 0;
}
没有找到相关结果
已邀请:
2 个回复
仇聘发栖
佩疵瓦