tmp/tmpwbob0684/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### General <a id="fstream.general">[[fstream.general]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std {
|
| 5 |
+
template<class charT, class traits = char_traits<charT>>
|
| 6 |
+
class basic_fstream : public basic_iostream<charT, traits> {
|
| 7 |
+
public:
|
| 8 |
+
using char_type = charT;
|
| 9 |
+
using int_type = typename traits::int_type;
|
| 10 |
+
using pos_type = typename traits::pos_type;
|
| 11 |
+
using off_type = typename traits::off_type;
|
| 12 |
+
using traits_type = traits;
|
| 13 |
+
|
| 14 |
+
// [fstream.cons], constructors
|
| 15 |
+
basic_fstream();
|
| 16 |
+
explicit basic_fstream(
|
| 17 |
+
const char* s,
|
| 18 |
+
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 19 |
+
explicit basic_fstream(
|
| 20 |
+
const filesystem::path::value_type* s,
|
| 21 |
+
ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see [fstream.syn]
|
| 22 |
+
explicit basic_fstream(
|
| 23 |
+
const string& s,
|
| 24 |
+
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 25 |
+
template<class T>
|
| 26 |
+
explicit basic_fstream(const T& s, ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 27 |
+
basic_fstream(const basic_fstream&) = delete;
|
| 28 |
+
basic_fstream(basic_fstream&& rhs);
|
| 29 |
+
|
| 30 |
+
basic_fstream& operator=(const basic_fstream&) = delete;
|
| 31 |
+
basic_fstream& operator=(basic_fstream&& rhs);
|
| 32 |
+
|
| 33 |
+
// [fstream.swap], swap
|
| 34 |
+
void swap(basic_fstream& rhs);
|
| 35 |
+
|
| 36 |
+
// [fstream.members], members
|
| 37 |
+
basic_filebuf<charT, traits>* rdbuf() const;
|
| 38 |
+
bool is_open() const;
|
| 39 |
+
void open(
|
| 40 |
+
const char* s,
|
| 41 |
+
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 42 |
+
void open(
|
| 43 |
+
const filesystem::path::value_type* s,
|
| 44 |
+
ios_base::openmode mode = ios_base::in|ios_base::out); // wide systems only; see [fstream.syn]
|
| 45 |
+
void open(
|
| 46 |
+
const string& s,
|
| 47 |
+
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 48 |
+
void open(
|
| 49 |
+
const filesystem::path& s,
|
| 50 |
+
ios_base::openmode mode = ios_base::in | ios_base::out);
|
| 51 |
+
void close();
|
| 52 |
+
|
| 53 |
+
private:
|
| 54 |
+
basic_filebuf<charT, traits> sb; // exposition only
|
| 55 |
+
};
|
| 56 |
+
}
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
The class template `basic_fstream<charT, traits>` supports reading and
|
| 60 |
+
writing from named files. It uses a `basic_filebuf<charT, traits>`
|
| 61 |
+
object to control the associated sequences. For the sake of exposition,
|
| 62 |
+
the maintained data is presented here as:
|
| 63 |
+
|
| 64 |
+
- `sb`, the `basic_filebuf` object.
|
| 65 |
+
|