Hi!
Does anyone know how to "write" a integer into a std::string?
Thank you very much for your time!
Printable View
Hi!
Does anyone know how to "write" a integer into a std::string?
Thank you very much for your time!
use a strstream and just "<<" it....
1) see the FAQ : http://www.codeguru.com/forum/showthread.php?t=231056
2) strstream ... isn't that deprecated ?
I got it. Thanks TheCPUWizard.
By the way, this is the function:
std::string CCLInformationColladaFile::IntegerToString(int i) {
std::ostringstream o;
if (!(o << i)) return "ERROR";
return o.str();
}
Not to the best of my knowledge...where did you here of the possibility????Quote:
Originally Posted by Philip Nicoletti
I thought that it was already deprecated (in C++ 98)
Somewhere in Annex D ... I do not have a copy of the
standard on this computer.
There is mention of it even in the draft... http://anubis.dkuug.dk/jtc1/sc22/open/n2356/
Have to look into the final when I get back to the office....
http://msdn2.microsoft.com/en-us/lib...f4(VS.80).aspx
Quote:
The classes in <strstream> are deprecated. Consider using the classes in <sstream> instead.
Thanks a lot.
I will try to change it.
Quote:
Originally Posted by riruilo
The code you posted already uses stringstream (which
is not deprecated).
No, his post is using the "smiley stream" class.. std::ostringstreamQuote:
Originally Posted by Philip Nicoletti
It is for generating "embarassing" output... :D :D
Hahahahaha