title: Reading int from a .csv file with fscanf function
body: <p>I'm trying to read some integers from a <code>.csv</code> file. I don't know exactly how many integers are in the file in each line, i just know that all the <code>csv</code> file is something like:</p>
  
  <pre><code>1,2,3,9,6,3,4
  4,5,6,7
  2,3,8,9,4
  </code></pre>
  
  <p>I need to store every line in an array, but I don't know how can I read integers values from a file without knowing how many integers are in the line.
  In my program I have to check if every line have just 2 elements and if the second element is equal to the sel value I receive from the main.</p>
  
  <pre><code> void fun1 (sel)
  {
      int aux[3];
      int res;
      FILE* fp;
  
  
      fd=fopen("c:\\myfile.csv","r");
      if(fd==NULL)
      {
          printf("Error");
          exit(-1);
      }
  
      while(!feof(fd))
      {
          res=fscanf(fd,"%d,%d,%d",&amp;aux[0],&amp;aux[1],&amp;aux[2]);
  
          if(res==2&amp;&amp;aux[1]==sel)
          {
  
              puts("Value ok");
          }
  
      }
      }
  </code></pre>
  
  <p>I've tried to put <code>3 %d</code> in the <code>fscanf</code> because if the line contains more then 2 elements I'm sure I don't need that line, but if the line contains more then 3 elements the program keep running without do anything. </p>
  
  <p>I think the problem appear because the <code>fscanf</code> function stop when reach a <code>'\n'</code> , but how can I fix the code if I don't know how many elements contains each line of the <code>.csv</code> file?</p>