相关: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;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3733 次 |
| 最近记录: |