Re: CString and Insertion Operator ( << )

Originally Posted by
[email protected]
Hi All,
Thanks for the responses. I tossed out points where the system would let me (SuperKoko: sorry - I'm told I have to spread them around).
In the end, I see I left out an important detail: CryptoPP::Integer defines operator<< on a stream (so pumping to std::cout works as expected).
I guess in the end I was looking for conversion code from the stream to a char[], and then from a char[] to a CString (trivial).
Jeff
So you just stream it to an ostringstream and use the str() function to initialise the CString
Code:
ostringstream os;
os << integer;
CString cs(os.str());
Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
-- Sutter and Alexandrescu, C++ Coding Standards
Programs must be written for people to read, and only incidentally for machines to execute.
-- Harold Abelson and Gerald Jay Sussman
The cheapest, fastest and most reliable components of a computer system are those that aren't there.
-- Gordon Bell