title: c++ open .txt file and read numbers to place in an array
body: <p>i have a text file that has the numbers on one line like (no spaces between commas):</p>
  
  <pre><code>    -1,5,-3,10,500000,-6000
  </code></pre>
  
  <p>so far this is the code i have but i am not getting anything back at all in the vector array</p>
  
  <pre><code>fstream fp;
  vector&lt;int&gt; numbers;
  int number;
  
  fp.open("numbers.txt", ios::in | ios::binary);
  
  if(fp.is_open()){
    while(fp &gt;&gt; number){
       numbers.push_back(number);
    }
  }
  
  fp.close();
  
  cout &lt;&lt; "Numbers:\n";
  for (int i=0; i &lt; numbers.size(); i++) {
      cout &lt;&lt; numbers[i] &lt;&lt; '\n';
  }
  </code></pre>
  
  <p>i feel like im just not reading the file properly or the whole line is just getting put into the number var. Also, the number of numbers in the file is unknown so i would like to stay away from hardcoding it</p>