We're seeing a strange scenario that basically boils down to the following:
std::string something = "someval";
std::stringstream s;
s << something;
std::cout << s.str();
is not equal to:
std::string something = "someval";
std::stringstream s;
s << something.c_str();
std::cout << s.str();
Taking that a step farther - the output is not gibberish in either case. What is happening is the output from case 1 appears to be mapped to another (valid) string in the system whereas the output from case 2 is what is expected.
We see this behavior by simply changing:
s << something;
To:
s << something.c_str();
I know this sounds crazy (or it does to me), and I haven't been able to replicate it out of the larger system - so sorry for no "working" example. But does anyone know how this kind of thing can happen? Can we be stepping on memory somewhere or doing something to a stringtable in some location or anything else like that?
stringstreamclass, that's just coincidence.somethingorsmight be ruined. Two things that have caused trouble for me: A.thisis actually deleted while I'm trying to operate on members, and B. I have unwittingly linked to different variants of the standard library (debug/release, or similar mixup) and I am trying to use astd::stringcreated by one implementation as if it were of the other implementation.s << something.c_str()leads toerror C2297: '<<' : illegal, right operand has type 'const char *'(MS Visual Studio 2008, strings included by#include<string>)