std::basic_ofstream
From cppreference.com
Defined in header <fstream>
|
||
template< class CharT, |
||
The class template basic_ofstream
implements high-level output operations on file based streams. It interfaces a file-based streambuffer (std::basic_filebuf) with the high-level interface of (std::basic_ostream).
A typical implementation of std::basic_ofstream
holds only one non-derived data member: an instance of std::basic_filebuf<CharT, Traits>.
Inheritance diagram
Several typedefs for common character types are provided:
Defined in header
<fstream> | |
Type | Definition |
std::ofstream
|
std::basic_ofstream<char> |
std::wofstream
|
std::basic_ofstream<wchar_t> |
Contents |
[edit] Member types
Member type | Definition |
char_type
|
CharT
|
traits_type
|
Traits ; the program is ill-formed if Traits::char_type is not CharT .
|
int_type
|
Traits::int_type
|
pos_type
|
Traits::pos_type
|
off_type
|
Traits::off_type
|
native_handle_type (C++26)
|
implementation-defined type that is TriviallyCopyable and semiregular
|
[edit] Member functions
constructs the file stream (public member function) | |
(destructor) [virtual] (implicitly declared) |
destructs the basic_ofstream and the associated buffer, closes the file (virtual public member function) |
(C++11) |
moves the file stream (public member function) |
(C++11) |
swaps two file streams (public member function) |
returns the underlying raw file device object (public member function) | |
(C++26) |
returns the underlying implementation-defined handle (public member function) |
File operations | |
checks if the stream has an associated file (public member function) | |
opens a file and associates it with the stream (public member function) | |
closes the associated file (public member function) |
[edit] Non-member functions
specializes the std::swap algorithm (function template) |
Inherited from std::basic_ostream
Member functions
Formatted output | |
inserts formatted data (public member function of std::basic_ostream<CharT,Traits> )
| |
Unformatted output | |
|