다음을 통해 공유


basic_ios::eof

Indicates if the end of a stream has been reached.

bool eof( ) const;

반환 값

true if the end of the stream has been reached, false otherwise.

설명

The member function returns true if rdstate & eofbit is nonzero. eofbit에 대한 자세한 내용은 ios_base::iostate을 참조하십시오.

예제

// 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;
}

샘플 출력

false
true

요구 사항

Header: <ios>

네임스페이스: std

참고 항목

참조

basic_ios 클래스

iostream 프로그래밍

iostreams 규칙