basic_ofstream::basic_ofstream

explicit basic_ofstream();
explicit basic_ofstream(const char *s,
    ios_base::openmode which = ios_base::out | ios_base::trunc);

The first constructor initializes the base class by calling basic_ostream(sb), where sb is the stored object of class basic_filebuf<E, T>. It also initializes sb by calling basic_filebuf<E, T>().

The second constructor initializes the base class by calling basic_ostream(sb). It also initializes sb by calling basic_filebuf<E, T>(), then sb.open(s, mode | ios_base::out). If the latter function returns a null pointer, the constructor calls setstate(failbit).