title: Writing a C++ vector to an output file
body: <pre><code>ofstream outputFile ("output.txt");
  
  if (outputFile.is_open())
  {
       outputFile &lt;&lt; "GLfloat vector[]={" &lt;&lt;  copy(vector.begin(), vector.end(), ostream_iterator&lt;float&gt;(cout, ", ")); &lt;&lt; "}" &lt;&lt; endl;
  }
  else cout &lt;&lt; "Unable to open output file";
  </code></pre>
  
  <p>How do I output a vector to a file, with each float separated by commas? I would also like to avoid printing square brackets if possible.</p>