30 Input/output library [input.output]

30.9 File-based streams [file.streams]

30.9.4 Class template basic_­ofstream [ofstream]

30.9.4.3 Member functions [ofstream.members]

basic_filebuf<charT, traits>* rdbuf() const;

Returns: const_­cast<basic_­filebuf<charT, traits>*>(&sb).

bool is_open() const;

Returns: rdbuf()->is_­open().

void open(const char* s, ios_base::openmode mode = ios_base::out); void open(const filesystem::path::value_type* s, ios_base::openmode mode = ios_base::out); // wide systems only; see [fstream.syn]

Effects: Calls rdbuf()->open(s, mode | ios_­base​::​out). If that function does not return a null pointer calls clear(), otherwise calls setstate(​failbit) (which may throw ios_­base​::​failure) ([iostate.flags]).

void close();

Effects: Calls rdbuf()->close() and, if that function fails (returns a null pointer), calls setstate(​failbit) (which may throw ios_­base​::​failure) ([iostate.flags]).

void open(const string& s, ios_base::openmode mode = ios_base::out); void open(const filesystem::path& s, ios_base::openmode mode = ios_base::out);

Effects: Calls open(s.c_­str(), mode).