I am creating a BINARY string stream that can do both input and output. I want to create a function that would give me the current size in bytes anytime I do an input or/and output when you do a read() or a write().
I have created this small example and I expected the gcount() would do that. But did not.
int main ()
std::stringstream sstr(std::stringstream::in | std::stringstream::out | std::stringstream::binary );
sstr.write("50", sizeof (int));
std::cout << "Count " << sstr.gcount() << std::endl; //Expected 4, but I get 0
sstr.read(readString, sizeof (int));;
std::cout << "Count " << sstr.gcount() << std::endl; // This is OK.
Any ideas how to do that?