#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    2
    Rep Power
    0

    converting a string to exponential


    How do you convert a string:
    "2.416919E-02"
    "-6.735472E-03"
    "-3.313178E-04"

    To exponential numbers?

    I've tried atof(stringName) and it gives me some really messed up numbers, and I'm at a loss as to what to do to get the conversion to work right.

    Thanks in advance for the assist,
    Addison
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    2
    Rep Power
    0
    Nevermind I found a solution ;)

    sscanf(word,"%lf",&currentForce);
    printf("word = %s, currentForce = %e", word, currentForce);

    heh didn't realize it would work...

    Thanks anyways for looking,
    Addison

IMN logo majestic logo threadwatch logo seochat tools logo