http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gameprogrammer] Re: How to assign a numeric variable to an std::string?



http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.1

--- 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
> 
> 
> 



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html