Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Indicates if the end of a stream has been reached.
bool eof( ) const;
Return Value
true if the end of the stream has been reached, false otherwise.
Remarks
The member function returns true if rdstate & eofbit is nonzero. For more information on eofbit, see ios_base::iostate.
Example
// basic_ios_eof.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>
using namespace std;
int main( int argc, char* argv[] )
{
fstream fs;
int n = 1;
fs.open( "basic_ios_eof.txt" ); // an empty file
cout << boolalpha
cout << fs.eof() << endl;
fs >> n; // Read the char in the file
cout << fs.eof() << endl;
}
Sample Output
false
true
Requirements
Header: <ios>
Namespace: std