title: C++ convert string to double with precision
body: <p>I need to convert string to double with precision up to 15 digits</p>
  
  <p>I have read many articles and similar questions, and they suggested to use setprecision(15) when printing out the numbers to the screen.</p>
  
  <p>For example:</p>
  
  <pre><code>string line = "34.9438553";
  double lon1 = strtod(line.c_str(),NULL);
  </code></pre>
  
  <p>if I write </p>
  
  <pre><code>cout &lt;&lt; lon1;
  </code></pre>
  
  <p>it will only print 34.9439 instead of 34.9438553</p>
  
  <p>I could've written </p>
  
  <pre><code>cout &lt;&lt; setprecision(15) &lt;&lt; lon1;
  </code></pre>
  
  <p>and it will work, but I need the variable lon1 itself to have 15 digits precision because I need the entire numbers inside the variable and not only when I'm printing it out to the screen.</p>
  
  <p>Does anyone know how to do it ? </p>