title: Skip lines while file scanning multiple lines
body: <p>This code will read a file and print it as long as the file is in this format</p>
  
  <pre><code>word,12,34
  words,40,20
  another,20,11
  </code></pre>
  
  <p>How do I get it to do the same if its got an empty line in between like this because right now it just gives me a segmentation fault</p>
  
  <pre><code>word,12,34
  
  words,40,20
  
  another,20,11
  
  
  
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  int main (int argc, char *argv[])
  {
      FILE *pdata;
      char buffer[1000];
      char *token, *del=",";
      int value1;
      double value2;
  
  
      pdata = fopen ("file.data", "r");
  
      if(pdata == NULL)
      {
          printf("unable to open file \n");
          exit(1);
      }
  
      while( fgets(buffer, sizeof(buffer), pdata) != NULL )
      {
          token = strtok(buffer, del);
          value1 = atoi( strtok(NULL, del) );
          value2 = atof( strtok(NULL, del) );
  
          printf("%s is %.3lf\n", token, value1 + value2);
  
      }
  
      fclose( pdata );
  
  
  return 0;
  }   
  </code></pre>
  
  <p>Please Help</p>