|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [gameprogrammer] Re: How to assign a numeric variable to an std::string?
I am a fan of sprintf and char * arrays as well so am not certain, but i believe what you are looking for is string.format (: On 1/11/08, Kevin Jenkins <gameprogrammer@rakkar.org> wrote: > float f=5; > std::string myStr; > myStr << f; > > It doesn't work. > > Error 1 error C2784: 'std::basic_ostream<_Elem,_Traits> &std::operator > <<(std::basic_ostream<_Elem,_Traits> &,const > std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce > template argument for 'std::basic_ostream<_Elem,_Traits> &' from > 'std::string' > > So how do I do this? E.G. > sprintf(str, "%f", f); > > --------------------- > To unsubscribe go to http://gameprogrammer.com/mailinglist.html > > > --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
|
|