ferror, feof, clearerr, fileno - check and reset stream status
#include <stdio.h>
int ferror(FILE *stream); //true if it's error
int feof(FILE *stream); //true if it's eof
//Both Return: nonzero(true) if true, 0(false) if false
void clearerr(FILE *stream); //clear both flags
int fileno(FILE *stream);
在FILE object中有两个标志位(flags)
- An error flag
- An end-of-file flag
clearerr能清除所有标志位
fileno() examines the argument stream and returns its integer descriptor.(检测stream流,并且返回整数描述符)

本文介绍了用于检查和重置文件流状态的几个关键函数:ferror(), feof(), clearerr() 和 fileno()。这些函数能够帮助程序员了解文件操作的状态,包括错误标志和结束标志,并提供了清除这些标志的方法。
899

被折叠的 条评论
为什么被折叠?



