From Jason Turner

[filebuf.members]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpwlh403z3/{from.md → to.md} +13 -12
tmp/tmpwlh403z3/{from.md → to.md} RENAMED
@@ -6,18 +6,19 @@ bool is_open() const;
6
 
7
  *Returns:* `true` if a previous call to `open` succeeded (returned a
8
  non-null value) and there has been no intervening call to close.
9
 
10
  ``` cpp
11
- basic_filebuf<charT,traits>* open(const char* s,
12
- ios_base::openmode mode);
 
13
  ```
14
 
15
  *Effects:* If `is_open() != false`, returns a null pointer. Otherwise,
16
  initializes the `filebuf` as required. It then opens a file, if
17
  possible, whose name is the NTBS`s` (as if by calling
18
- `std::fopen(s,modstr)`). The NTBS`modstr` is determined from
19
  `mode & ~ios_base::ate` as indicated in
20
  Table  [[tab:iostreams.file.open.modes]]. If `mode` is not some
21
  combination of flags shown in the table then the open fails.
22
 
23
  **Table: File open modes** <a id="tab:iostreams.file.open.modes">[tab:iostreams.file.open.modes]</a>
@@ -43,40 +44,40 @@ combination of flags shown in the table then the open fails.
43
  | + | + | | | + | `"a+b"` |
44
 
45
 
46
  If the open operation succeeds and `(mode & ios_base::ate) != 0`,
47
  positions the file to the end (as if by calling
48
- `std::fseek(file,0,SEEK_END)`).[^39]
49
 
50
  If the repositioning operation fails, calls `close()` and returns a null
51
  pointer to indicate failure.
52
 
53
  *Returns:* `this` if successful, a null pointer otherwise.
54
 
55
  ``` cpp
56
- basic_filebuf<charT,traits>* open(const string& s,
57
- ios_base::openmode mode);
58
  ```
59
 
60
  *Returns:* `open(s.c_str(), mode);`
61
 
62
  ``` cpp
63
- basic_filebuf<charT,traits>* close();
64
  ```
65
 
66
  *Effects:* If `is_open() == false`, returns a null pointer. If a put
67
  area exists, calls `overflow(traits::eof())` to flush characters. If the
68
  last virtual member function called on `*this` (between `underflow`,
69
  `overflow`, `seekoff`, and `seekpos`) was `overflow` then calls
70
  `a_codecvt.unshift` (possibly several times) to determine a termination
71
  sequence, inserts those characters and calls `overflow(traits::eof())`
72
  again. Finally, regardless of whether any of the preceding calls fails
73
  or throws an exception, the function closes the file (as if by calling
74
- `std::fclose(file)`).[^40] If any of the calls made by the function,
75
- including `std::fclose`, fails, `close` fails by returning a null
76
- pointer. If one of these calls throws an exception, the exception is
77
- caught and rethrown after closing the file.
78
 
79
  *Returns:* `this` on success, a null pointer otherwise.
80
 
81
- `is_open() == false`.
82
 
 
6
 
7
  *Returns:* `true` if a previous call to `open` succeeded (returned a
8
  non-null value) and there has been no intervening call to close.
9
 
10
  ``` cpp
11
+ basic_filebuf* open(const char* s, ios_base::openmode mode);
12
+ basic_filebuf* open(const filesystem::path::value_type* s,
13
+ ios_base::openmode mode); // wide systems only; see [fstream.syn]
14
  ```
15
 
16
  *Effects:* If `is_open() != false`, returns a null pointer. Otherwise,
17
  initializes the `filebuf` as required. It then opens a file, if
18
  possible, whose name is the NTBS`s` (as if by calling
19
+ `fopen(s, modstr)`). The NTBS`modstr` is determined from
20
  `mode & ~ios_base::ate` as indicated in
21
  Table  [[tab:iostreams.file.open.modes]]. If `mode` is not some
22
  combination of flags shown in the table then the open fails.
23
 
24
  **Table: File open modes** <a id="tab:iostreams.file.open.modes">[tab:iostreams.file.open.modes]</a>
 
44
  | + | + | | | + | `"a+b"` |
45
 
46
 
47
  If the open operation succeeds and `(mode & ios_base::ate) != 0`,
48
  positions the file to the end (as if by calling
49
+ `fseek(file, 0, SEEK_END)`).[^40]
50
 
51
  If the repositioning operation fails, calls `close()` and returns a null
52
  pointer to indicate failure.
53
 
54
  *Returns:* `this` if successful, a null pointer otherwise.
55
 
56
  ``` cpp
57
+ basic_filebuf* open(const string& s, ios_base::openmode mode);
58
+ basic_filebuf* open(const filesystem::path& s, ios_base::openmode mode);
59
  ```
60
 
61
  *Returns:* `open(s.c_str(), mode);`
62
 
63
  ``` cpp
64
+ basic_filebuf* close();
65
  ```
66
 
67
  *Effects:* If `is_open() == false`, returns a null pointer. If a put
68
  area exists, calls `overflow(traits::eof())` to flush characters. If the
69
  last virtual member function called on `*this` (between `underflow`,
70
  `overflow`, `seekoff`, and `seekpos`) was `overflow` then calls
71
  `a_codecvt.unshift` (possibly several times) to determine a termination
72
  sequence, inserts those characters and calls `overflow(traits::eof())`
73
  again. Finally, regardless of whether any of the preceding calls fails
74
  or throws an exception, the function closes the file (as if by calling
75
+ `fclose(file)`). If any of the calls made by the function, including
76
+ `fclose`, fails, `close` fails by returning a null pointer. If one of
77
+ these calls throws an exception, the exception is caught and rethrown
78
+ after closing the file.
79
 
80
  *Returns:* `this` on success, a null pointer otherwise.
81
 
82
+ *Postconditions:* `is_open() == false`.
83