1

I have old c++ code using strstream and using pcount and freeze methods of the same. I want to use stringstream class instead. What are the substitute for pcount and freeze methods of strstream? The code is something like this:

strstream log; // this will change to: stringstream log;

if (log.pcount()) //????
{
    log << ends;
    *myLog << log.str() << logmsg;
}

log.freeze(0); //????
Shahbaz
  • 46,337
  • 19
  • 116
  • 182
Sam
  • 243
  • 1
  • 9
  • 22

1 Answers1

3

freeze() is something which has and need no replacement, its purpose is the handling of memory.

log.pcount() can be replaced with log.str().size() if your stringstream is output only. If not, I don't think there is a good replacement. BTW, ends is unneeded as well.

AProgrammer
  • 51,233
  • 8
  • 91
  • 143