要想了解 feof(FILE* stream)
如何使用,需要我们对文件读写的几个基本概念进行澄清。
-
FILE
结构体由以下几个成员组成- (C95) Character width: unset, narrow, or wide.
- (C95) Parse state for conversions between multibyte and wide characters (an object of type mbstate_t)
- Buffering state: unbuffered, line-buffered, fully buffered.
- The buffer, which may be replaced by an external, user-provided buffer.
- I/O mode: input, output, or update (both input and output).
- Binary/text mode indicator.
- End-of-file status indicator.
- Error status indicator.
- File position indicator, accessible as an object of type fpos_t, which, for wide streams, includes parse state.
- (C11) Reentrant lock used to prevent data races when multiple threads read, write, position, or query the position of a stream.
其中,FILE结构体中有一个End-of-file status indicator
,当打开某个文件时,文件指针默认将End-of-fil