[ostream.unformatted] (original) (raw)
31 Input/output library [input.output]
31.7 Formatting and manipulators [iostream.format]
31.7.6 Output streams [output.streams]
31.7.6.4 Unformatted output functions [ostream.unformatted]
Each unformatted output function begins execution by constructing an object of classsentry.
If that object returnstrue, while converting to a value of typebool, the function endeavors to generate the requested output.
If an exception is thrown during output, thenios_base::badbitis set289in*this's error state.
If(exceptions() & badbit) != 0then the exception is rethrown.
In any case, the unformatted output function ends by destroying thesentry object, then, if no exception was thrown, returning the value specified for the unformatted output function.
basic_ostream& put(char_type c);
Effects: Behaves as an unformatted output function (as described above).
After constructing a sentryobject, inserts the character c, if possible.290
Otherwise, callssetstate(badbit)(which may throwios_base::failure ([iostate.flags])).
basic_ostream& write(const char_type* s, streamsize n);
Effects: Behaves as an unformatted output function (as described above).
After constructing a sentryobject, obtains characters to insert from successive locations of an array whose first element is designated bys.291
Characters are inserted until either of the following occurs:
- n characters are inserted;
- inserting in the output sequence fails (in which case the function callssetstate(badbit), which may throwios_base::failure ([iostate.flags])).
Effects: Behaves as an unformatted output function (as described above).
Ifrdbuf()is not a null pointer, constructs a sentry object.
If that object returns true when converted to a value of type bool the function callsrdbuf()->pubsync().
If that function returns callssetstate(badbit)(which may throwios_base::failure ([iostate.flags])).
Otherwise, if the sentry object returns false, does nothing.