tmp/tmpgj5t7r3z/{from.md → to.md}
RENAMED
|
@@ -215,11 +215,11 @@ basic_filebuf<charT,traits>* open(const char* s,
|
|
| 215 |
|
| 216 |
*Effects:* If `is_open() != false`, returns a null pointer. Otherwise,
|
| 217 |
initializes the `filebuf` as required. It then opens a file, if
|
| 218 |
possible, whose name is the NTBS`s` (as if by calling
|
| 219 |
`std::fopen(s,modstr)`). The NTBS`modstr` is determined from
|
| 220 |
-
`mode &
|
| 221 |
Table [[tab:iostreams.file.open.modes]]. If `mode` is not some
|
| 222 |
combination of flags shown in the table then the open fails.
|
| 223 |
|
| 224 |
**Table: File open modes** <a id="tab:iostreams.file.open.modes">[tab:iostreams.file.open.modes]</a>
|
| 225 |
|
|
@@ -244,11 +244,11 @@ combination of flags shown in the table then the open fails.
|
|
| 244 |
| + | + | | | + | `"a+b"` |
|
| 245 |
|
| 246 |
|
| 247 |
If the open operation succeeds and `(mode & ios_base::ate) != 0`,
|
| 248 |
positions the file to the end (as if by calling
|
| 249 |
-
`std::fseek(file,0,SEEK_END)`).[^
|
| 250 |
|
| 251 |
If the repositioning operation fails, calls `close()` and returns a null
|
| 252 |
pointer to indicate failure.
|
| 253 |
|
| 254 |
*Returns:* `this` if successful, a null pointer otherwise.
|
|
@@ -270,11 +270,11 @@ last virtual member function called on `*this` (between `underflow`,
|
|
| 270 |
`overflow`, `seekoff`, and `seekpos`) was `overflow` then calls
|
| 271 |
`a_codecvt.unshift` (possibly several times) to determine a termination
|
| 272 |
sequence, inserts those characters and calls `overflow(traits::eof())`
|
| 273 |
again. Finally, regardless of whether any of the preceding calls fails
|
| 274 |
or throws an exception, the function closes the file (as if by calling
|
| 275 |
-
`std::fclose(file)`).[^
|
| 276 |
including `std::fclose`, fails, `close` fails by returning a null
|
| 277 |
pointer. If one of these calls throws an exception, the exception is
|
| 278 |
caught and rethrown after closing the file.
|
| 279 |
|
| 280 |
*Returns:* `this` on success, a null pointer otherwise.
|
|
@@ -520,11 +520,11 @@ namespace std {
|
|
| 520 |
bool is_open() const;
|
| 521 |
void open(const char* s, ios_base::openmode mode = ios_base::in);
|
| 522 |
void open(const string& s, ios_base::openmode mode = ios_base::in);
|
| 523 |
void close();
|
| 524 |
private:
|
| 525 |
-
basic_filebuf<charT,traits> sb; // exposition
|
| 526 |
};
|
| 527 |
|
| 528 |
template <class charT, class traits>
|
| 529 |
void swap(basic_ifstream<charT, traits>& x,
|
| 530 |
basic_ifstream<charT, traits>& y);
|
|
@@ -672,11 +672,11 @@ namespace std {
|
|
| 672 |
bool is_open() const;
|
| 673 |
void open(const char* s, ios_base::openmode mode = ios_base::out);
|
| 674 |
void open(const string& s, ios_base::openmode mode = ios_base::out);
|
| 675 |
void close();
|
| 676 |
private:
|
| 677 |
-
basic_filebuf<charT,traits> sb; // exposition
|
| 678 |
};
|
| 679 |
|
| 680 |
template <class charT, class traits>
|
| 681 |
void swap(basic_ofstream<charT, traits>& x,
|
| 682 |
basic_ofstream<charT, traits>& y);
|
|
@@ -828,11 +828,11 @@ namespace std {
|
|
| 828 |
void open(const string& s,
|
| 829 |
ios_base::openmode mode = ios_base::in|ios_base::out);
|
| 830 |
void close();
|
| 831 |
|
| 832 |
private:
|
| 833 |
-
basic_filebuf<charT,traits> sb; // exposition
|
| 834 |
};
|
| 835 |
|
| 836 |
template <class charT, class traits>
|
| 837 |
void swap(basic_fstream<charT, traits>& x,
|
| 838 |
basic_fstream<charT, traits>& y);
|
|
@@ -948,11 +948,12 @@ void close();
|
|
| 948 |
returns a null pointer, calls `setstate(failbit)` ([[iostate.flags]])
|
| 949 |
(which may throw `ios_base::failure`).
|
| 950 |
|
| 951 |
### C library files <a id="c.files">[[c.files]]</a>
|
| 952 |
|
| 953 |
-
Table [[tab:iostreams.hdr.cstdio]] describes header `<cstdio>`.
|
|
|
|
| 954 |
|
| 955 |
Calls to the function `tmpnam` with an argument of `NULL` may introduce
|
| 956 |
a data race ([[res.on.data.races]]) with other calls to `tmpnam` with
|
| 957 |
an argument of `NULL`.
|
| 958 |
|
|
@@ -989,11 +990,10 @@ Library header `<inttypes.h>`, with the following changes:
|
|
| 989 |
[bitmask.types]: library.md#bitmask.types
|
| 990 |
[c.files]: #c.files
|
| 991 |
[enumerated.types]: library.md#enumerated.types
|
| 992 |
[error.reporting]: #error.reporting
|
| 993 |
[ext.manip]: #ext.manip
|
| 994 |
-
[facet.num.put.virtuals]: localization.md#facet.num.put.virtuals
|
| 995 |
[fig:streampos]: #fig:streampos
|
| 996 |
[file.streams]: #file.streams
|
| 997 |
[filebuf]: #filebuf
|
| 998 |
[filebuf.assign]: #filebuf.assign
|
| 999 |
[filebuf.cons]: #filebuf.cons
|
|
@@ -1088,10 +1088,11 @@ Library header `<inttypes.h>`, with the following changes:
|
|
| 1088 |
[ostringstream]: #ostringstream
|
| 1089 |
[ostringstream.assign]: #ostringstream.assign
|
| 1090 |
[ostringstream.cons]: #ostringstream.cons
|
| 1091 |
[ostringstream.members]: #ostringstream.members
|
| 1092 |
[output.streams]: #output.streams
|
|
|
|
| 1093 |
[res.on.data.races]: library.md#res.on.data.races
|
| 1094 |
[res.on.exception.handling]: library.md#res.on.exception.handling
|
| 1095 |
[std.ios.manip]: #std.ios.manip
|
| 1096 |
[std.manip]: #std.manip
|
| 1097 |
[stream.buffers]: #stream.buffers
|
|
@@ -1201,81 +1202,85 @@ Library header `<inttypes.h>`, with the following changes:
|
|
| 1201 |
|
| 1202 |
[^15]: Classes derived from `basic_streambuf` can provide more efficient
|
| 1203 |
ways to implement `xsgetn()` and `xsputn()` by overriding these
|
| 1204 |
definitions from the base class.
|
| 1205 |
|
| 1206 |
-
[^16]:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1207 |
library. The semantics of the constructor used in user code is as
|
| 1208 |
specified.
|
| 1209 |
|
| 1210 |
-
[^
|
| 1211 |
implementation-dependent operations.
|
| 1212 |
|
| 1213 |
-
[^
|
| 1214 |
-
|
| 1215 |
-
[^19]: See, for example, the function signature
|
| 1216 |
-
`ws(basic_istream&)` ([[istream.manip]]).
|
| 1217 |
|
| 1218 |
[^20]: See, for example, the function signature
|
|
|
|
|
|
|
|
|
|
| 1219 |
`dec(ios_base&)` ([[basefield.manip]]).
|
| 1220 |
|
| 1221 |
-
[^
|
| 1222 |
-
|
| 1223 |
-
[^22]: Note that this function is not overloaded on types `signed char`
|
| 1224 |
-
and `unsigned char`.
|
| 1225 |
|
| 1226 |
[^23]: Note that this function is not overloaded on types `signed char`
|
| 1227 |
and `unsigned char`.
|
| 1228 |
|
| 1229 |
[^24]: Note that this function is not overloaded on types `signed char`
|
| 1230 |
and `unsigned char`.
|
| 1231 |
|
| 1232 |
-
[^25]:
|
|
|
|
|
|
|
|
|
|
| 1233 |
the `gcount()`, even though it is not stored.
|
| 1234 |
|
| 1235 |
-
[^
|
| 1236 |
setting `failbit`. This is different behavior than the historical
|
| 1237 |
AT&T implementation.
|
| 1238 |
|
| 1239 |
-
[^
|
| 1240 |
set.
|
| 1241 |
|
| 1242 |
-
[^
|
| 1243 |
and `unsigned char`.
|
| 1244 |
|
| 1245 |
-
[^
|
| 1246 |
function can determine that no synchronization is necessary.
|
| 1247 |
|
| 1248 |
-
[^
|
| 1249 |
additional implementation-dependent operations.
|
| 1250 |
|
| 1251 |
-
[^
|
| 1252 |
-
|
| 1253 |
-
[^32]: See, for example, the function signature
|
| 1254 |
-
`endl(basic_ostream&)` ([[ostream.manip]]).
|
| 1255 |
|
| 1256 |
[^33]: See, for example, the function signature
|
|
|
|
|
|
|
|
|
|
| 1257 |
`dec(ios_base&)` ([[basefield.manip]]).
|
| 1258 |
|
| 1259 |
-
[^
|
| 1260 |
-
|
| 1261 |
-
[^35]: Note that this function is not overloaded on types `signed char`
|
| 1262 |
-
and `unsigned char`.
|
| 1263 |
|
| 1264 |
[^36]: Note that this function is not overloaded on types `signed char`
|
| 1265 |
and `unsigned char`.
|
| 1266 |
|
| 1267 |
-
[^37]:
|
|
|
|
|
|
|
|
|
|
| 1268 |
`ios_base::skipws` in the format flags stored in the
|
| 1269 |
`basic_istream<charT,traits>` object `cin` (the same as
|
| 1270 |
`cin >>noskipws`), and the expression
|
| 1271 |
`cout << resetiosflags(ios_base::showbase)` clears
|
| 1272 |
`ios_base::showbase` in the format flags stored in the
|
| 1273 |
`basic_ostream<charT,traits>` object `cout` (the same as
|
| 1274 |
`cout <<noshowbase`).
|
| 1275 |
|
| 1276 |
-
[^
|
| 1277 |
`fopen(const char*, const char*)` and `fseek(FILE*, long, int)` are
|
| 1278 |
declared, in `<cstdio>` ([[c.files]]).
|
| 1279 |
|
| 1280 |
-
[^
|
| 1281 |
([[c.files]]).
|
|
|
|
| 215 |
|
| 216 |
*Effects:* If `is_open() != false`, returns a null pointer. Otherwise,
|
| 217 |
initializes the `filebuf` as required. It then opens a file, if
|
| 218 |
possible, whose name is the NTBS`s` (as if by calling
|
| 219 |
`std::fopen(s,modstr)`). The NTBS`modstr` is determined from
|
| 220 |
+
`mode & ~ios_base::ate` as indicated in
|
| 221 |
Table [[tab:iostreams.file.open.modes]]. If `mode` is not some
|
| 222 |
combination of flags shown in the table then the open fails.
|
| 223 |
|
| 224 |
**Table: File open modes** <a id="tab:iostreams.file.open.modes">[tab:iostreams.file.open.modes]</a>
|
| 225 |
|
|
|
|
| 244 |
| + | + | | | + | `"a+b"` |
|
| 245 |
|
| 246 |
|
| 247 |
If the open operation succeeds and `(mode & ios_base::ate) != 0`,
|
| 248 |
positions the file to the end (as if by calling
|
| 249 |
+
`std::fseek(file,0,SEEK_END)`).[^39]
|
| 250 |
|
| 251 |
If the repositioning operation fails, calls `close()` and returns a null
|
| 252 |
pointer to indicate failure.
|
| 253 |
|
| 254 |
*Returns:* `this` if successful, a null pointer otherwise.
|
|
|
|
| 270 |
`overflow`, `seekoff`, and `seekpos`) was `overflow` then calls
|
| 271 |
`a_codecvt.unshift` (possibly several times) to determine a termination
|
| 272 |
sequence, inserts those characters and calls `overflow(traits::eof())`
|
| 273 |
again. Finally, regardless of whether any of the preceding calls fails
|
| 274 |
or throws an exception, the function closes the file (as if by calling
|
| 275 |
+
`std::fclose(file)`).[^40] If any of the calls made by the function,
|
| 276 |
including `std::fclose`, fails, `close` fails by returning a null
|
| 277 |
pointer. If one of these calls throws an exception, the exception is
|
| 278 |
caught and rethrown after closing the file.
|
| 279 |
|
| 280 |
*Returns:* `this` on success, a null pointer otherwise.
|
|
|
|
| 520 |
bool is_open() const;
|
| 521 |
void open(const char* s, ios_base::openmode mode = ios_base::in);
|
| 522 |
void open(const string& s, ios_base::openmode mode = ios_base::in);
|
| 523 |
void close();
|
| 524 |
private:
|
| 525 |
+
basic_filebuf<charT,traits> sb; // exposition only
|
| 526 |
};
|
| 527 |
|
| 528 |
template <class charT, class traits>
|
| 529 |
void swap(basic_ifstream<charT, traits>& x,
|
| 530 |
basic_ifstream<charT, traits>& y);
|
|
|
|
| 672 |
bool is_open() const;
|
| 673 |
void open(const char* s, ios_base::openmode mode = ios_base::out);
|
| 674 |
void open(const string& s, ios_base::openmode mode = ios_base::out);
|
| 675 |
void close();
|
| 676 |
private:
|
| 677 |
+
basic_filebuf<charT,traits> sb; // exposition only
|
| 678 |
};
|
| 679 |
|
| 680 |
template <class charT, class traits>
|
| 681 |
void swap(basic_ofstream<charT, traits>& x,
|
| 682 |
basic_ofstream<charT, traits>& y);
|
|
|
|
| 828 |
void open(const string& s,
|
| 829 |
ios_base::openmode mode = ios_base::in|ios_base::out);
|
| 830 |
void close();
|
| 831 |
|
| 832 |
private:
|
| 833 |
+
basic_filebuf<charT,traits> sb; // exposition only
|
| 834 |
};
|
| 835 |
|
| 836 |
template <class charT, class traits>
|
| 837 |
void swap(basic_fstream<charT, traits>& x,
|
| 838 |
basic_fstream<charT, traits>& y);
|
|
|
|
| 948 |
returns a null pointer, calls `setstate(failbit)` ([[iostate.flags]])
|
| 949 |
(which may throw `ios_base::failure`).
|
| 950 |
|
| 951 |
### C library files <a id="c.files">[[c.files]]</a>
|
| 952 |
|
| 953 |
+
Table [[tab:iostreams.hdr.cstdio]] describes header `<cstdio>`. C++does
|
| 954 |
+
not define the function `gets`.
|
| 955 |
|
| 956 |
Calls to the function `tmpnam` with an argument of `NULL` may introduce
|
| 957 |
a data race ([[res.on.data.races]]) with other calls to `tmpnam` with
|
| 958 |
an argument of `NULL`.
|
| 959 |
|
|
|
|
| 990 |
[bitmask.types]: library.md#bitmask.types
|
| 991 |
[c.files]: #c.files
|
| 992 |
[enumerated.types]: library.md#enumerated.types
|
| 993 |
[error.reporting]: #error.reporting
|
| 994 |
[ext.manip]: #ext.manip
|
|
|
|
| 995 |
[fig:streampos]: #fig:streampos
|
| 996 |
[file.streams]: #file.streams
|
| 997 |
[filebuf]: #filebuf
|
| 998 |
[filebuf.assign]: #filebuf.assign
|
| 999 |
[filebuf.cons]: #filebuf.cons
|
|
|
|
| 1088 |
[ostringstream]: #ostringstream
|
| 1089 |
[ostringstream.assign]: #ostringstream.assign
|
| 1090 |
[ostringstream.cons]: #ostringstream.cons
|
| 1091 |
[ostringstream.members]: #ostringstream.members
|
| 1092 |
[output.streams]: #output.streams
|
| 1093 |
+
[quoted.manip]: #quoted.manip
|
| 1094 |
[res.on.data.races]: library.md#res.on.data.races
|
| 1095 |
[res.on.exception.handling]: library.md#res.on.exception.handling
|
| 1096 |
[std.ios.manip]: #std.ios.manip
|
| 1097 |
[std.manip]: #std.manip
|
| 1098 |
[stream.buffers]: #stream.buffers
|
|
|
|
| 1202 |
|
| 1203 |
[^15]: Classes derived from `basic_streambuf` can provide more efficient
|
| 1204 |
ways to implement `xsgetn()` and `xsputn()` by overriding these
|
| 1205 |
definitions from the base class.
|
| 1206 |
|
| 1207 |
+
[^16]: Typically, `overflow` returns `c` to indicate success, except
|
| 1208 |
+
when `traits::eq_int_type(c,traits::eof())` returns `true`, in which
|
| 1209 |
+
case it returns `traits::not_eof(c)`.
|
| 1210 |
+
|
| 1211 |
+
[^17]: This will be possible only in functions that are part of the
|
| 1212 |
library. The semantics of the constructor used in user code is as
|
| 1213 |
specified.
|
| 1214 |
|
| 1215 |
+
[^18]: The sentry constructor and destructor can also perform additional
|
| 1216 |
implementation-dependent operations.
|
| 1217 |
|
| 1218 |
+
[^19]: This is done without causing an `ios::failure` to be thrown.
|
|
|
|
|
|
|
|
|
|
| 1219 |
|
| 1220 |
[^20]: See, for example, the function signature
|
| 1221 |
+
`ws(basic_istream&)` ([[istream.manip]]).
|
| 1222 |
+
|
| 1223 |
+
[^21]: See, for example, the function signature
|
| 1224 |
`dec(ios_base&)` ([[basefield.manip]]).
|
| 1225 |
|
| 1226 |
+
[^22]: This is done without causing an `ios::failure` to be thrown.
|
|
|
|
|
|
|
|
|
|
| 1227 |
|
| 1228 |
[^23]: Note that this function is not overloaded on types `signed char`
|
| 1229 |
and `unsigned char`.
|
| 1230 |
|
| 1231 |
[^24]: Note that this function is not overloaded on types `signed char`
|
| 1232 |
and `unsigned char`.
|
| 1233 |
|
| 1234 |
+
[^25]: Note that this function is not overloaded on types `signed char`
|
| 1235 |
+
and `unsigned char`.
|
| 1236 |
+
|
| 1237 |
+
[^26]: Since the final input character is “extracted,” it is counted in
|
| 1238 |
the `gcount()`, even though it is not stored.
|
| 1239 |
|
| 1240 |
+
[^27]: This allows an input line which exactly fills the buffer, without
|
| 1241 |
setting `failbit`. This is different behavior than the historical
|
| 1242 |
AT&T implementation.
|
| 1243 |
|
| 1244 |
+
[^28]: This implies an empty input line will not cause `failbit` to be
|
| 1245 |
set.
|
| 1246 |
|
| 1247 |
+
[^29]: Note that this function is not overloaded on types `signed char`
|
| 1248 |
and `unsigned char`.
|
| 1249 |
|
| 1250 |
+
[^30]: The call `os.tie()->flush()` does not necessarily occur if the
|
| 1251 |
function can determine that no synchronization is necessary.
|
| 1252 |
|
| 1253 |
+
[^31]: The `sentry` constructor and destructor can also perform
|
| 1254 |
additional implementation-dependent operations.
|
| 1255 |
|
| 1256 |
+
[^32]: without causing an `ios::failure` to be thrown.
|
|
|
|
|
|
|
|
|
|
| 1257 |
|
| 1258 |
[^33]: See, for example, the function signature
|
| 1259 |
+
`endl(basic_ostream&)` ([[ostream.manip]]).
|
| 1260 |
+
|
| 1261 |
+
[^34]: See, for example, the function signature
|
| 1262 |
`dec(ios_base&)` ([[basefield.manip]]).
|
| 1263 |
|
| 1264 |
+
[^35]: without causing an `ios::failure` to be thrown.
|
|
|
|
|
|
|
|
|
|
| 1265 |
|
| 1266 |
[^36]: Note that this function is not overloaded on types `signed char`
|
| 1267 |
and `unsigned char`.
|
| 1268 |
|
| 1269 |
+
[^37]: Note that this function is not overloaded on types `signed char`
|
| 1270 |
+
and `unsigned char`.
|
| 1271 |
+
|
| 1272 |
+
[^38]: The expression `cin >>resetiosflags(ios_base::skipws)` clears
|
| 1273 |
`ios_base::skipws` in the format flags stored in the
|
| 1274 |
`basic_istream<charT,traits>` object `cin` (the same as
|
| 1275 |
`cin >>noskipws`), and the expression
|
| 1276 |
`cout << resetiosflags(ios_base::showbase)` clears
|
| 1277 |
`ios_base::showbase` in the format flags stored in the
|
| 1278 |
`basic_ostream<charT,traits>` object `cout` (the same as
|
| 1279 |
`cout <<noshowbase`).
|
| 1280 |
|
| 1281 |
+
[^39]: The macro `SEEK_END` is defined, and the function signatures
|
| 1282 |
`fopen(const char*, const char*)` and `fseek(FILE*, long, int)` are
|
| 1283 |
declared, in `<cstdio>` ([[c.files]]).
|
| 1284 |
|
| 1285 |
+
[^40]: The function signature `fclose(FILE*)` is declared in `<cstdio>`
|
| 1286 |
([[c.files]]).
|