title: Error using getline with ifstream - C++
body: <p>I need help, I tried googling if I could find a similar problem but the solutions for others didn't work for me.</p>
  
  <p>I'm trying to use <code>getline()</code> to read the file I've opened but it's not accepting the parameters I've given it. </p>
  
  <p>What I'm trying to accomplish at this time (not the entire program) is to open a <code>.csv</code> file and determine how many elements it has inside by using <code>getline()</code> and using the <code>,</code> character as the delimiter. My loop has an index which I could just add 1 to it so that I can get the total number of elements inside the file. </p>
  
  <p>The reason I'm doing this is because I intend to use it for a project at school but so far I've gotten stuck at the <code>getline()</code> error:</p>
  
  <blockquote>
    <p>no matching function for call to 'std::basic_ifstream::getline(std::string&amp;, int, const char [2])'</p>
  </blockquote>
  
  <p>My code is here:</p>
  
  <pre><code>void readfile(string a)
  {
      int i = 0;
      ifstream infile;
      infile.open(a.c_str());
      string temp;
  
      //count how many elements are inside
      if(infile.is_open())
      {
          while(infile.good())
          {
              infile.getline(temp, 256, ",");
              i++;
          }
          infile.close();
          i+=1;
      }
      else
      {
          cout&lt;&lt;"Error opening file.";
      }
      cout&lt;&lt;i;
  }
  </code></pre>