title: Parsing data from ASCII formatted file in C
body: <p>I am trying to do what's been done here <a href="https://stackoverflow.com/questions/1037219/read-co-ordinates-from-a-txt-files-using-c-program">Read co-ordinates from a txt files using C Program</a> . The data that I am trying to input is in this format:</p>
  
  <pre><code>f 10 20 21
  f 8 15 11
  . . .  .
  f 11 12 25
  </code></pre>
  
  <p>The only difference in my point structure is that I have a an extra char to store the letter in the first column (which may or may not be the letter f). I guess im either declaring my char wrong, or I'm calling it in <code>printf</code> incorrectly. Either way, I only get the first line read and then my program terminates. Any ideas ?</p>
  
  <p>Here is my MWE below</p>
  
  <pre><code>#define FILEPATHtri "/pathto/grid1DT.txt"
  #define FILEPATHorg "/pathto/grid1.txt"
  #define MAX  4000
  
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include "math.h"
  
  typedef struct
  {    
      float x;
      float y;
      float z;
      char t[1];
  }Point;
  
  int main(void) {
  
      Point *points = malloc( MAX * sizeof (Point) ) ;
  
      FILE *fp ;
      fp = fopen( FILEPATHtri,"r");
  
  int i = 0;
  
  while(fscanf(fp, "%s %f %f %f ", points[i].t, &amp;points[i].x, &amp;points[i].y, &amp;points[i].z ) == 4 )
  {
      i++;
  }
  fclose(fp);
  
  int n;
  
  
  for (n=0; n&lt;=i; n++){
  
      printf("%c  %2.5f %2.5f %2.5f \n", points[i].t, points[n].x, points[n].y, points[n].z ); }
  
  
      printf("There are i = %i  points in the file \n And I have read n = %i  points ",i,n);
  
  return 0;
  
  }
  </code></pre>