basic_ofstream::open

void open(const char *s,
    ios_base::openmode mode = ios_base::out | ios_base::trunc);

The member function calls rdbuf()-> open(s, mode | ios_base::out). If that function returns a null pointer, the function calls setstate(failbit).