clearerr, feof, ferror, fileno - check and reset stream status
clearerr, feof, ferror, fileno - 检查和重置流状态
所需头文件
#include <stdio.h>
void clearerr(FILE *stream);
int feof(FILE *stream);
int ferror(FILE *stream);
int fileno(FILE *stream);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
fileno(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE
The function clearerr() clears the end-of-file and error indicators for the stream pointed to by stream.
clearerr清除流对应的eof和错误符
The function feof() tests the end-of-file indicator for the stream pointed to by stream, returning nonzero if it is set. The end-of-file indicator can only be cleared by the function clearerr().
feof测试流的eof符,如果是eof则返回非0值,eof符只能使用clearerr清除
The function ferror() tests the error indicator for the stream pointed to by stream, returning nonzero if it is set. The error indicator can only be reset by the clearerr() function.
ferror函数测试流的error符,如果是error符则返回非0值,error符只能通过clearerr重置
The function fileno() examines the argument stream and returns its integer descriptor.
fileno检测参数给定的流,返回整型的文件描述符
For nonlocking counterparts, see unlocked_stdio(3).
针对非阻塞的副本,可以查看unlocked_stdio
These functions should not fail and do not set the external variable errno. (However, in case fileno() detects that its argument is not a valid stream, it must return -1 and set errno to EBADF.)
这些函数不会有错误,所以没有设置内部的errno值
clearerr, feof, ferror, fileno - 检查和重置流状态
所需头文件
#include <stdio.h>
void clearerr(FILE *stream);
int feof(FILE *stream);
int ferror(FILE *stream);
int fileno(FILE *stream);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
fileno(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE
The function clearerr() clears the end-of-file and error indicators for the stream pointed to by stream.
clearerr清除流对应的eof和错误符
The function feof() tests the end-of-file indicator for the stream pointed to by stream, returning nonzero if it is set. The end-of-file indicator can only be cleared by the function clearerr().
feof测试流的eof符,如果是eof则返回非0值,eof符只能使用clearerr清除
The function ferror() tests the error indicator for the stream pointed to by stream, returning nonzero if it is set. The error indicator can only be reset by the clearerr() function.
ferror函数测试流的error符,如果是error符则返回非0值,error符只能通过clearerr重置
The function fileno() examines the argument stream and returns its integer descriptor.
fileno检测参数给定的流,返回整型的文件描述符
For nonlocking counterparts, see unlocked_stdio(3).
针对非阻塞的副本,可以查看unlocked_stdio
These functions should not fail and do not set the external variable errno. (However, in case fileno() detects that its argument is not a valid stream, it must return -1 and set errno to EBADF.)
这些函数不会有错误,所以没有设置内部的errno值