1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

string to double

Discussion in 'C' started by kimw, Sep 10, 2006.

  1. kimw

    kimw New Member

    Joined:
    Sep 10, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    I have a string that i want to convert to double. i know atof is a standard library function for that, however, the input argument to atof is (const char*), not string type that i have.

    does anyone know how i might convert my string num to double ? thanks

    Code:
    string num = "45.00";
    double x = atof(num);
     
  2. Aztec

    Aztec New Member

    Joined:
    May 9, 2006
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    0
    string is C++ type. It's not part of C. Are you sure it's a C code?
     

Share This Page