std::basic_filebuf<CharT,Traits>::is_open (3) - Linux Manuals
std::basic_filebuf<CharT,Traits>::is_open: std::basic_filebuf<CharT,Traits>::is_open
Command to display std::basic_filebuf<CharT,Traits>::is_open
manual in Linux: $ man 3 std::basic_filebuf<CharT,Traits>::is_open
NAME
std::basic_filebuf<CharT,Traits>::is_open - std::basic_filebuf<CharT,Traits>::is_open
Synopsis
bool is_open() const;
Returns true if the most recent call to open() succeeded and there has been no call to close() since then.
Parameters
(none)
Return value
true if the associated file is open, false otherwise.
Notes
This function is typically called by std::basic_fstream::is_open().
Example
// 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';
}
Output:
direct call: true
through streambuf: true
through fstream: true
See also
opens a file and configures it as the associated character sequence
open (public member function)
flushes the put area buffer and closes the associated file
close (public member function)
Pages related to std::basic_filebuf<CharT,Traits>::is_open
- std::basic_filebuf<CharT,Traits>::imbue (3) - std::basic_filebuf<CharT,Traits>::imbue
- std::basic_filebuf<CharT,Traits>::basic_filebuf (3) - std::basic_filebuf<CharT,Traits>::basic_filebuf
- std::basic_filebuf<CharT,Traits>::close (3) - std::basic_filebuf<CharT,Traits>::close
- std::basic_filebuf<CharT,Traits>::open (3) - std::basic_filebuf<CharT,Traits>::open
- std::basic_filebuf<CharT,Traits>::operator= (3) - std::basic_filebuf<CharT,Traits>::operator=
- std::basic_filebuf<CharT,Traits>::overflow (3) - std::basic_filebuf<CharT,Traits>::overflow
- std::basic_filebuf<CharT,Traits>::pbackfail (3) - std::basic_filebuf<CharT,Traits>::pbackfail
- std::basic_filebuf<CharT,Traits>::seekoff (3) - std::basic_filebuf<CharT,Traits>::seekoff
- std::basic_filebuf<CharT,Traits>::seekpos (3) - std::basic_filebuf<CharT,Traits>::seekpos
- std::basic_filebuf<CharT,Traits>::setbuf (3) - std::basic_filebuf<CharT,Traits>::setbuf
- std::basic_filebuf<CharT,Traits>::showmanyc (3) - std::basic_filebuf<CharT,Traits>::showmanyc
- std::basic_filebuf<CharT,Traits>::swap (3) - std::basic_filebuf<CharT,Traits>::swap
- std::basic_filebuf<CharT,Traits>::sync (3) - std::basic_filebuf<CharT,Traits>::sync
- std::basic_filebuf<CharT,Traits>::uflow (3) - std::basic_filebuf<CharT,Traits>::uflow
- std::basic_filebuf<CharT,Traits>::underflow (3) - std::basic_filebuf<CharT,Traits>::underflow
- std::basic_filebuf<CharT,Traits>::~basic_filebuf (3) - std::basic_filebuf<CharT,Traits>::~basic_filebuf
- std::basic_filebuf (3) - std::basic_filebuf
- std::basic_fstream (3) - std::basic_fstream