buckysFile.is_open()

What does buckysFile.is_open() does?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <fstream>

using namespace std;

int main(){

    ofstream buckysFile("beefjerky.txt");

    if(buckysFile.is_open()){
        cout << "Ok, the file is open." << endl;
    }else{
        cout << "Bucky you are messed up!" << endl;
    }

    buckysFile << "I love beef! \n";
    buckysFile.close();

    return 0;
}
http://www.cplusplus.com/reference/fstream/ofstream/is_open/

Feel free to use the reference section, although it should be fairly obvious from the code what it does.
Topic archived. No new replies allowed.