Can someone explain why the following code produce " you!" instead of "hello you!".
int main() {
std::stringstream ss("hello");
ss << " you!";
cout << ss.str() << endl;
}
openmode must have ate set.
This is what you're looking for:
int main() {
std::stringstream ss("hello", std::ios_base::out | std::ios_base::ate);
ss << " you!";
cout << ss.str() << endl;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With