[ofstream.members] (original) (raw)

31 Input/output library [input.output]

31.10 File-based streams [file.streams]

31.10.5 Class template basic_ofstream [ofstream]

31.10.5.4 Member functions [ofstream.members]

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

Returns: const_cast<basic_filebuf<charT, traits>*>(addressof(sb)).

native_handle_type native_handle() const noexcept;

Effects: Equivalent to: return rdbuf()->native_handle();

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]](fstream.syn "31.10.1 Header <fstream> synopsis")

Effects: Callsrdbuf()->open(s, mode | ios_base​::​out).

If that function does not return a null pointer calls clear(), otherwise callssetstate(​failbit)(which may throwios_base​::​failure) ([iostate.flags]).

Effects: Callsrdbuf()->close()and, if that function fails (returns a null pointer), callssetstate(​failbit)(which may throwios_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).