std::basic_ofstream::basic_ofstream
From Cppreference
< cpp | io | basic ofstream
C++ Standard Library | ||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Input/output library | ||||||||||||||||||||||||||||||||||||||||||||||||||||
std::basic_ofstream | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||
basic_ofstream( const char *filename,
ios_base::openmode mode = ios_base::out ); |
(1) | |
basic_ofstream( const string &filename,
ios_base::openmode mode = ios_base::out ); |
(2) | (C++11 feature) |
basic_ofstream( basic_ofstream&& other );
|
(3) | (C++11 feature) |
Constructs new file stream.
1-2) Associates the stream with a file after the constriction. Calls clear() on success or setstate(failbit) on failure.
The first version effectively calls rdbuf()->open(filename, mode | ios_base::out).
The second version effectively calls open(filename.c_str(), mode).
3) Move constructor. Constructs the file stream with the state of other using move semantics.
[edit] Parameters
filename | - | the name of the file to be opened | ||||||||||||||||||||||||||||
mode | - | specifies stream open mode. It is bitmask type, the following constants are defined:
|
||||||||||||||||||||||||||||
other | - | another file stream to use as source |
[edit] Example
This section is incomplete |
[edit] See also
|
opens a file and associates it with the stream (public member function) |