title: C++ : Writing doubles in a file with more precision than default
body: <p>I want to write doubles to a file but the string cast reduces the precision.
  Edit : I don't really cast but put the doubles in an ostringstream.</p>
  
  <p>Is there another way than parsing each digit using modulo and division to write the doubles with more precision  ?</p>
  
  <p>Edit : My application needs to be portable</p>
  
  <p>Here is my current code :</p>
  
  <pre><code>std::string arraytocsv(double v[], int size) {  
      std::ostringstream oss;
      for (int i = 0; i &lt; size; i++) {
          oss &lt;&lt; v[i] &lt;&lt; ";";
      }
      oss &lt;&lt; std::endl;
      return oss.str();
  }
  </code></pre>
  
  <p>I've had the precision() function, it works. Thanks</p>