[gameprogrammer] Re: How to assign a numeric variable to an std::string?
- From: Vince <uberneen@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Fri, 11 Jan 2008 13:47:42 -0800 (PST)
http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.1
--- Kevin Jenkins <gameprogrammer@xxxxxxxxxx> 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
- References:
- [gameprogrammer] How to assign a numeric variable to an std::string?
- From: Kevin Jenkins
Other related posts:
- » [gameprogrammer] How to assign a numeric variable to an std::string?
- » [gameprogrammer] Re: How to assign a numeric variable to an std::string?
- » [gameprogrammer] Re: How to assign a numeric variable to an std::string?
- » [gameprogrammer] Re: How to assign a numeric variable to an std::string?
- » [gameprogrammer] Re: How to assign a numeric variable to an std::string?
- » [gameprogrammer] Re: How to assign a numeric variable to an std::string?
- » [gameprogrammer] Re: How to assign a numeric variable to an std::string?
- » [gameprogrammer] Re: How to assign a numeric variable to an std::string?
- [gameprogrammer] How to assign a numeric variable to an std::string?
- From: Kevin Jenkins