The filebuf
constructor to which these flags are passed† has behaviours based on those flags defined in Table 132 in C++11:
+-----------------------------------+-------------------+
| ios_base flag combination | stdio equivalent |
| binary in out trunc app | |
+-----------------------------------+-------------------+
| + | "w" |
| + + | "a" |
| + | "a" |
| + + | "w" |
| + | "r" |
| + + | "r+" |
| + + + | "w+" |
| + + + | "a+" |
| + + | "a+" |
+-----------------------------------+-------------------+
| + + | "wb" |
| + + + | "ab" |
| + + | "ab" |
| + + + | "wb" |
| + + | "rb" |
| + + + | "r+b" |
| + + + + | "w+b" |
| + + + + | "a+b" |
| + + + | "a+b" |
+-----------------------------------+-------------------+
As you can see, your flag combination is not found in that table.
[C++11: 27.9.1.4/2]:
[..] If mode
is not some combination of flags shown in the table then the open fails.
Those are the semantics.
† [C++11: 27.9.1.7/2]
& [C++11: 27.9.1.11/2]
show us that the mode is passed from the stream object to the buffer object.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…