Compartilhar via


basic_filebuf::is_open

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

See Also

Reference

basic_filebuf Class

iostream Programming

iostreams Conventions

Other Resources

basic_filebuf Members