title: Using getline with CSV
body: <p>I've spent almost 4 hours trying to get past this issue...</p>
  
  <p>I have a text file with over 100 rows.  Each row has 4 values separated by commas.  I want to be able to extract each value and save it into a variable (v1...v4).  </p>
  
  <p>I have used a for loop, as I won't be reading the entire contents of the file. I'm just trying to get 1 working for now.</p>
  
  <p>So far, I have managed to read a single row.  I just need to break the row up now.  This is for my Uni assignment, and I am not allowed to use any boost or tokeniser classes.  Just getline and other basic commands.</p>
  
  <p>I have this code:</p>
  
  <pre><code>// Read contents from books.txt file
  ifstream theFile("fileName.txt");
  string v1, v2, v3, v4, line;
  
  for (int i = 0; i &lt; 1; i++) {
      getline(theFile, line, '\n');
      cout &lt;&lt; line &lt;&lt; endl;  // This part works fine
      getline(line, v1, ",");  // Error here
      cout &lt;&lt; v1 &lt;&lt; endl;
      getline(line, v2, ",");  // Error here
      cout &lt;&lt; v2 &lt;&lt; endl;
      getline(line, v3, ",");  // Error here
      cout &lt;&lt; v3 &lt;&lt; endl;
      getline(line, v4, '\n');  // Error here
      cout &lt;&lt; v4 &lt;&lt; endl;
  }
  
  theFile.close();
  </code></pre>
  
  <p>The error I get is - error: no matching function for call to ‘getline(std::string&amp;, std::string&amp;, const char [2])</p>
  
  <p>How can I fix this?</p>