Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Indicates whether a file is open.
bool is_open( ) const;
Return Value
true if the file pointer is not a null pointer.
Example
// basic_filebuf_is_open.cpp
// compile with: /EHsc
#include <fstream>
#include <iostream>
int main( ) 
{
   using namespace std;
   ifstream file;
   cout << boolalpha << file.rdbuf( )->is_open( ) << endl;
   file.open( "basic_filebuf_is_open.cpp" );
   cout << file.rdbuf( )->is_open( ) << endl;
}
false true
Requirements
Header: <fstream>
Namespace: std