title: count until a character is found then set counter to zero after appending it to an array
body: <p>so I have a file that's structured like this</p>
  <pre><code>01
  ,
  10
  11
  00
  ,
  00
  ;
  </code></pre>
  <p>each line can only hold 2 0s or 1s, and there can be any amount of lines over 0 in between the commas and I need to count every line until there's a comma and append that value to an array then set the counter to 0. if the function finds a ; it saves that value then breaks the loop</p>
  <p>currently I'm stuck on getting it to count up correctly, maybe I'm just not understanding how getline works</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  
  
  int main()
  {
    std::string line[4];
    std::ifstream infile(&quot;in.txt&quot;);
    std::ofstream outfile(&quot;inData.txt&quot;);
  
  
    int x;
    while(!infile.eof())
    {
      getline(infile,line[0],'\n'); // tried with a , for \n and that correctly increases x for every comma
      ++x;
      std::cout &lt;&lt; &quot;x: &quot; &lt;&lt; x &lt;&lt; &quot;\n&quot;; 
  
  
      // if(getline(infile, line[0],';')) {break;}
      // need to break if ; is found but from what I've seen it just makes it iterate once then break when I was using a , in the first getline
    }
    std::cin.get();
  }
  </code></pre>