This function overloads the global operator<< to behave as described in ostream::operator<< but applied to string objects.
Parameters
- os
- ostream object on which the insertion operation is performed.
- str
- string object output by the operation.
Return Value
The same as parameter os.Errors are signaled by modifying the internal state flags:
| flag | error |
|---|---|
| eofbit | - |
| failbit | When used with a streambuf object as parameter, failbit is set on if no characters could be extracted from it. |
| badbit | An error other than the above happened. |
(see ios_base::iostate for more info on these)
Additionaly, in any of these cases, if the appropriate flag has been set with member function ios::exceptions, an exception of type ios_base::failure is thrown.
If some error happens during the output operation, the stream's badbit flag is set, and if the appropriate flag has been set with ios::exceptions, an exception is thrown.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Basic template declaration
| 1 2 3 4 |
|
See also
| ostream::operator<< | Insert data with format (public member function) |
| operator>> | Extract string from istream (function) |
