title: ifstream get line change output from char to string
body: <p>C++ ifstream get line change getline output from char to string</p>
  
  <p>I got a text file.. so i read it and i do something like</p>
  
  <pre><code>char data[50];
  readFile.open(filename.c_str());
  
  while(readFile.good())
  {
  readFile.getline(data,50,',');
  
  cout &lt;&lt; data &lt;&lt; endl;
  
  }
  </code></pre>
  
  <p>My question is instead of creating a char with size 50 by the variable name data, can i get the getline to a string instead something like</p>
  
  <pre><code>string myData;
  readFile.getline(myData,',');
  </code></pre>
  
  <p>My text file is something like this</p>
  
  <p>Line2D, [3,2]
  Line3D, [7,2,3]</p>
  
  <p>I tried and the compiler say..</p>
  
  <p>no matching function for getline(std::string&amp;,char)</p>
  
  <p>so is it possible to still break by delimiter, assign value to a string instead of a char.</p>
  
  <p>Updates:</p>
  
  <p>Using</p>
  
  <pre><code>while (std::getline(readFile, line))
  {
      std::cout &lt;&lt; line &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>IT read line by line, but i wanna break the string into several delimiter, originally if using char i will specify the delimiter as the 3rd element which is</p>
  
  <p>readFile.getline(data,50,'<strong>,</strong>');</p>
  
  <p>how do i do with string if i break /explode with delimiter comma , the one above. in line by line</p>