Debian Codegraph @

yo/iostreams/examples/isopen.cc

raw
1 #include <fstream>
2 #include <iostream>
3
4 using namespace std;
5
6 int main()
7 {
8 ofstream of;
9
10 cout << "of's open state: " << boolalpha << of.is_open() << '\n';
11
12 of.open("/dev/null"); // on Unix systems
13
14 cout << "of's open state: " << of.is_open() << '\n';
15 }
16 /*
17 Generated output:
18 of's open state: false
19 of's open state: true
20 */