EOF是什么？ - 阮一峰的网络日志
It is a macro definition of type int that expands into（扩展成） a negative integral constant expression (generally, -1).
It is used as the value returned by several functions in header <cstdio> to indicate that the End-of-File has been reached or to signal some other failure conditions.
It is also used as the value to represent an invalid character.
In C++, this macro corresponds to the value of char_traits<char>::eof().
template <class charT> struct char_traits; template <> struct char_traits<char>; template <> struct char_traits<wchar_t>;
Character traits classes specify character properties and provide specific semantics for certain operations on characters and sequences of characters.
The standard library includes a standard set of character traits classes that can be instantiated from the char_traitstemplate, and which are used by default both for the basic_string objects and for the input/output stream objects. But any other class that follows the requirements of a character traits class can be used instead. This reference attempts to describe both the definition of the standard char_traits and the requirements for custom character traits classes.
The class defines the standard character traits for this character type.
This shall be one of the types for which an specialization is provided.
Aliased as member type char_traits::char_type.
The char_traits standard template supports to be instantiated with at least the following character types:
|char||Basic character set (size of 1 byte)|
|wchar_t||Wide character set (same size, signedness, and alignment as another integral type)|
|member type||description for character traits types||definition|
|char_type||The template parameter (charT)||char||wchar_t|
|int_type||Integral type that can represent all charT values, as well as eof()||int||wint_t|
|off_type||A type that behaves like streamoff||streamoff||streamoff|
|pos_type||A type that behaves like streampos||streampos||wstreampos|
|state_type||Multibyte transformation state type, such as mbstate_t||mbstate_t||mbstate_t|
Compare characters for equality ( public static member function )
Compare characters for inequality ( public static member function )
Get length of null-terminated string ( public static member function )
Assign character ( public static member function )
Compare sequences of characters ( public static member function )
Find first occurrence of character ( public static member function )
Move character sequence ( public static member function )
Copy character sequence ( public static member function )
End-of-File character ( public static member function )
Not End-of-File character ( public static member function )
To char type ( public static member function )
To int type ( public static member function )
Compare int_type values ( public static member function )