title: C++ Converting a String to Double
body: <p>I've been trying to find the solution for this all day! You might label this as re-post but what I'm really looking for is a solution <strong>without using boost lexical cast</strong>. A traditional C++ way of doing it would be great. I tried this code but it returns a set of gibberish numbers and letters.</p>
  
  <pre><code>string line; 
  double lineconverted;
  
  istringstream buffer(line);
  lineconverted;
  buffer &gt;&gt; lineconverted;
  </code></pre>
  
  <p>And I alse tried this, but it ALWAYS returns 0.</p>
  
  <pre><code>stringstream convert(line);
  if ( !(convert &gt;&gt; lineconverted) ) {
      lineconverted  = 0;
  }
  </code></pre>
  
  <p>Thanks in advance :)</p>
  
  <p>EDIT: For the first solution I used (gibberish).. Here's a snapshot
  <img src="https://i.stack.imgur.com/Cb4UC.png" alt="enter image description here"></p>