tmp/tmpsf440qec/{from.md → to.md}
RENAMED
|
@@ -11,19 +11,20 @@ non-null value) and there has been no intervening call to close.
|
|
| 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
|
| 18 |
-
possible,
|
| 19 |
-
|
| 20 |
-
`mode
|
| 21 |
-
|
| 22 |
-
combination of flags shown in the table then the open fails.
|
| 23 |
|
| 24 |
-
**Table: File open modes** <a id="
|
| 25 |
|
| 26 |
| `binary` | `in` | `out` | `trunc` | `app` | | `stdio` equivalent |
|
| 27 |
| -------- | ---- | ----- | ------- | ----- | --- | ------------------ |
|
| 28 |
| | | + | | | `"w"` |
|
| 29 |
| | | + | | + | `"a"` |
|
|
@@ -42,13 +43,14 @@ combination of flags shown in the table then the open fails.
|
|
| 42 |
| + | + | + | + | | `"w+b"` |
|
| 43 |
| + | + | + | | + | `"a+b"` |
|
| 44 |
| + | + | | | + | `"a+b"` |
|
| 45 |
|
| 46 |
|
| 47 |
-
If the open operation succeeds and `
|
| 48 |
positions the file to the end (as if by calling
|
| 49 |
-
`fseek(file, 0, SEEK_END)`
|
|
|
|
| 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.
|
|
@@ -77,7 +79,7 @@ or throws an exception, the function closes the file (as if by calling
|
|
| 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 |
-
*
|
| 83 |
|
|
|
|
| 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 |
+
*Preconditions:* `s` points to a NTCTS [[defns.ntcts]].
|
| 17 |
+
|
| 18 |
*Effects:* If `is_open() != false`, returns a null pointer. Otherwise,
|
| 19 |
+
initializes the `filebuf` as required. It then opens the file to which
|
| 20 |
+
`s` resolves, if possible, as if by a call to `fopen` with the second
|
| 21 |
+
argument determined from `mode & ~ios_base::ate` as indicated in
|
| 22 |
+
[[filebuf.open.modes]]. If `mode` is not some combination of flags shown
|
| 23 |
+
in the table then the open fails.
|
|
|
|
| 24 |
|
| 25 |
+
**Table: File open modes** <a id="filebuf.open.modes">[filebuf.open.modes]</a>
|
| 26 |
|
| 27 |
| `binary` | `in` | `out` | `trunc` | `app` | | `stdio` equivalent |
|
| 28 |
| -------- | ---- | ----- | ------- | ----- | --- | ------------------ |
|
| 29 |
| | | + | | | `"w"` |
|
| 30 |
| | | + | | + | `"a"` |
|
|
|
|
| 43 |
| + | + | + | + | | `"w+b"` |
|
| 44 |
| + | + | + | | + | `"a+b"` |
|
| 45 |
| + | + | | | + | `"a+b"` |
|
| 46 |
|
| 47 |
|
| 48 |
+
If the open operation succeeds and `ios_base::ate` is set in `mode`,
|
| 49 |
positions the file to the end (as if by calling
|
| 50 |
+
`fseek(file, 0, SEEK_END)`, where `file` is the pointer returned by
|
| 51 |
+
calling `fopen`). [^40]
|
| 52 |
|
| 53 |
If the repositioning operation fails, calls `close()` and returns a null
|
| 54 |
pointer to indicate failure.
|
| 55 |
|
| 56 |
*Returns:* `this` if successful, a null pointer otherwise.
|
|
|
|
| 79 |
these calls throws an exception, the exception is caught and rethrown
|
| 80 |
after closing the file.
|
| 81 |
|
| 82 |
*Returns:* `this` on success, a null pointer otherwise.
|
| 83 |
|
| 84 |
+
*Ensures:* `is_open() == false`.
|
| 85 |
|