GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::basic_filebuf::is_open(3) C++ Standard Libary std::basic_filebuf::is_open(3)

std::basic_filebuf::is_open - std::basic_filebuf::is_open


bool is_open() const;


Returns true if the most recent call to open() succeeded and there has been no call
to close() since then.


(none)


true if the associated file is open, false otherwise.


This function is typically called by std::basic_fstream::is_open().

// Run this code


#include <fstream>
#include <iostream>


int main()
{
std::ifstream fs("test.txt");
std::filebuf fb;
fb.open("test.txt", std::ios_base::in);
std::cout << std::boolalpha
<< "direct call: " << fb.is_open() << '\n'
<< "through streambuf: " << fs.rdbuf()->is_open() << '\n'
<< "through fstream: " << fs.is_open() << '\n';
}


direct call: true
through streambuf: true
through fstream: true


open opens a file and configures it as the associated character sequence
(public member function)
close flushes the put area buffer and closes the associated file
(public member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.