title: cout not printing string of vector after getline
body: <p>I have a .csv file with following contents:</p>
  <pre><code>1.0,2.0
  2.0,3.0
  </code></pre>
  <p>Now i want to read this file and print it to the terminal.
  I want the output look like this:</p>
  <pre><code>1.0|2.0|
  2.0|3.0|
  </code></pre>
  <p>But all i get is:</p>
  <pre><code>|
  |
  </code></pre>
  <p>When i run the debugger the vector contains the correct data but it just wont print it.</p>
  <p>Vector array while cout (debugger):</p>
  <pre><code>array = {std::vector&lt;std::vector&gt;}
     [0] = {std::vector&lt;std::basic_string, std::allocator&gt;}
        [0] = {std::basic_string&lt;char, std::char_traits, std::allocator&gt;} &quot;1.0&quot;
        [1] = {std::basic_string&lt;char, std::char_traits, std::allocator&gt;} &quot;2.0\r&quot;
     [1] = {std::vector&lt;std::basic_string, std::allocator&gt;}
        [0] = {std::basic_string&lt;char, std::char_traits, std::allocator&gt;} &quot;2.0&quot;
        [1] = {std::basic_string&lt;char, std::char_traits, std::allocator&gt;} &quot;3.0\r&quot;
  </code></pre>
  <p>My code:</p>
  <pre><code>#include &lt;string&gt;
  #include &lt;sstream&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;fstream&gt;
  
  int main()
  {
      using namespace std;
  
      ifstream in(&quot;C:\\Users\\freit\\CLionProjects\\Aufgabe2\\data.csv&quot;, ios_base::in);
  
      string line, field;
  
      vector&lt; vector&lt;string&gt; &gt; array;  // the 2D array
      vector&lt;string&gt; v;                // array of values for one line only
  
      while ( getline(in,line) )    // get next line in file
      {
          v.clear();
          stringstream ss(line);
  
          while (getline(ss,field,','))  // break line into comma delimited fields
          {
              v.push_back(field);  // add each field to the 1D array
          }
  
          array.push_back(v);  // add the 1D array to the 2D array
      }
  
      // print out what was read in
  
      for (size_t i=0; i&lt;array.size(); ++i)
      {
          for (size_t j=0; j&lt;array[i].size(); ++j)
          {
              cout.flush();
              cout &lt;&lt; array[i][j] &lt;&lt; &quot;|&quot;; // (separate fields by |)
          }
          cout &lt;&lt; &quot;\n&quot;;
      }
  
      return 0;
  }
  </code></pre>