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流,并且返回整数描述符)