riruilo
May 16th, 2007, 01:47 PM
Hi!
Does anyone know how to "write" a integer into a std::string?
Thank you very much for your time!
Does anyone know how to "write" a integer into a std::string?
Thank you very much for your time!
|
Click to See Complete Forum and Search --> : integer to std::string riruilo May 16th, 2007, 01:47 PM Hi! Does anyone know how to "write" a integer into a std::string? Thank you very much for your time! TheCPUWizard May 16th, 2007, 01:55 PM use a strstream and just "<<" it.... Philip Nicoletti May 16th, 2007, 01:59 PM 1) see the FAQ : http://www.codeguru.com/forum/showthread.php?t=231056 2) strstream ... isn't that deprecated ? riruilo May 16th, 2007, 01:59 PM 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(); } TheCPUWizard May 16th, 2007, 02:29 PM 2) strstream ... isn't that deprecated ? Not to the best of my knowledge...where did you here of the possibility???? Philip Nicoletti May 16th, 2007, 02:39 PM 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. TheCPUWizard May 16th, 2007, 02:47 PM 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.... Zaccheus May 16th, 2007, 02:50 PM http://msdn2.microsoft.com/en-us/library/4e4xe3f4(VS.80).aspx The classes in <strstream> are deprecated. Consider using the classes in <sstream> instead. riruilo May 16th, 2007, 02:53 PM Thanks a lot. I will try to change it. Philip Nicoletti May 16th, 2007, 03:44 PM Thanks a lot. I will try to change it. The code you posted already uses stringstream (which is not deprecated). TheCPUWizard May 16th, 2007, 03:50 PM The code you posted already uses stringstream (whichis not deprecated). No, his post is using the "smiley stream" class.. std::ostringstream It is for generating "embarassing" output... :D :D riruilo May 16th, 2007, 07:59 PM Hahahahaha codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |