To test whether the file was opened.
bool is_open();
The is_open() function is used to check that a file stream was indeed opened and ready for output. You should always test with this function after using the constructor or the open() function to open a stream.
If an attempt is made to open a file in an inappropriate file opening mode, the file will not open and a test for the object will not give false, therefore use the function is_open() to check for file openings.
Returns true if file stream is open and available for output.
For example of basic_ofstream::is_open() usage see basic_ofstream::ofstream()