C++ Type conversion

Tim Aidley tim.aidley at framestore-cfc.com
Thu Oct 31 09:59:21 GMT 2002


You can use an istringstream, defined in <sstring>:

    #include <sstring>        // includes etc
    #include <string>
    using namespace std;

    string         snum = "1.23456";
    float          fnum;
    istringstream  stream(snum);

    stream >> fnum;           // Tada! fnum = 1.23456

However, this is the kdevelop mailing list, and plain C++ questions 
should probably not be discussed here. You could always try 
comp.lang.c++ (Although always read the FAQ first! ;-) )

cheers,

Tim



Martin Bammer wrote:

>How do convert a string into a floating point value in C++????
>
>-
>to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
>unsubscribe »your-email-address«
>  
>


-- 

Tim Aidley
Research and Development
Framestore-CFC
tim.aidley at framestore-cfc.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20021031/f7e9ab54/attachment.html>


More information about the KDevelop mailing list