title: Strings and array of structures
body: <p>***UPDATED WITH NEW CODE
  I'm trying to load a file data with an unknown amount of lines of data.
  The data is organized as last, first:score1:score2:score3:score5:lettergrade</p>
  
  <p>I'm getting the file to (sort of) load into an array and print.
  When the data prints, it doesn't print the first name, just the first. It's printing the same integer for evert data element except for the last one, that comes out at 0 for all. Also, it's not flushing the data that doesn't return 8 elements.
  PLEASE help!
  Thanks in advance.</p>
  
  <pre><code>    #include &lt;stdio.h&gt;
      #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
      #define FFLUSH while(fgetsc(fp) != '\n')
      #define MAX_STUDENTS 45
  
          typedef struct aStudent
          {
              char name[26];
              int id[7];
              int test1[4];
              int test2[4];
              int proj1[4];
              int proj2[4];
              int proj3[4];
              char grade[4];
          } aStudent;
  
          int main(void)
          {
  
          char file_name[FILENAME_MAX];
          FILE* fp;
          int i;
          int rc;
          int dc;
          aStudent studentArray[MAX_STUDENTS];
  
          printf("Enter File Name:    ");
          rc = scanf("%s", &amp;file_name);
          if (rc == 0)
          {
              printf("\n\nError: No file name entered.");
              exit(0);
          }
  
          fp = fopen(file_name, "r");
  
          if (fp == NULL)
          {
              printf("Error: Could not open file %s for read", file_name);
              exit(0);
          }
  
              for(int i=0; i&lt; 45; i++)
              {
  
              dc = (fscanf(fp, "%s[^:]%d[^:]%d[^:]%d[^:]%d[^:]%d[^:]%d[^:]%f[^:]%c[^:\n]", studentArray[i].name, studentArray[i].id, studentArray[i].test1, studentArray[i].test2, studentArray[i].proj1, studentArray[i].proj2, studentArray[i].proj3, studentArray[i].grade));
  
              if (dc != 8)
              {
                  FFLUSH;
              }
  
                  printf("%s %d %d %d %d %d %d %.2f %c", studentArray[i].name, studentArray[i].id, studentArray[i].test1, studentArray[i].test2, studentArray[i].proj1, studentArray[i].proj2, studentArray[i].proj3, studentArray[i].grade);
  
          }
  
        return 0;
      }
  </code></pre>