title: Read file line by line and store values
body: <p>I have a file.txt like:</p>
  
  <pre><code>4,3
  3,2
  5,1
  6,5
  </code></pre>
  
  <p>Every line is a coordinate. For the first line, x1=4, y1 = 3. Then for the second line, x2=3, y2=2, and so on. The purpose of this method is to get the 4 coordinates inside the file and store them inside a variables or an array. I thought the best way was to create an array for x and another one for y, so we would have <code>coordX[]</code> and <code>coordY[]</code>. Since the file I must read will always contain only 4 coordinates, both arrays will have a size of [3].
  The code I'm using right now is this:</p>
  
  <pre><code>void readFile(){
     int x1, y1;
     int coordX[3], coordY[3];
     while (infile &gt;&gt; x1 &gt;&gt; y1){
         //How to insert the coordinates into coordX[] and coordY[]?
     }
  }
  </code></pre>
  
  <p>As you can see, I don't know how to make the method insert the values of each coordinate into the array, is there a way to do it using an array? Or should I create <code>int</code> variables x1, y1, x2, y2, and so on? Thanks in advance! </p>