29 Apr
2024
29 Apr
'24
6:48 p.m.
You just need to disable automatic flushing: s1 << std::nounitbuf; // or s1.unsetf(std::ios_base::unitbuf); https://en.cppreference.com/w/cpp/io/manip/unitbuf By the way you can call connect directly on s1 no need to take a reference.