title: Why doesn't my fscanf read?
body: <p>I'm trying to read information from the <code>file.txt</code> into BST.
  First, I was thinking of saving info into temporary mini-arrays, and than assigning those values to the tree nodes. Apparently something goes wrong, I'm sure that one thing is the incorrect regular expression and might be something else. Please help me to figure out how to save data to the BST, I'm really late with this project.</p>
  
  <p>Samples of data contained in the input <code>file.txt</code>:</p>
  
  <pre><code>3800 Lee, Victor; 2.8
  3000 Brown, Joanne; 4.0
  1300 South, Frankie; 2.6
  4000 Trapp, Dave; 3.9
  </code></pre>
  
  <p>They have to be read and parsed into: 1)<code>int= id</code>, 2)<code>char= name</code>, 3)<code>float= gpa</code> </p>
  
  <p>They have to be saved properly, without any symbols, so when I will do search in my next functions it wont give me any errors.</p>
  
  <p>Here is my code below(UPDATED):</p>
  
  <pre><code>int readFile(BST_TREE *list) {
  int id  = 0;
  int val = 0;
  int ln  = 0;
  float gpa = 0.0;
  char name[MAX_NAME_LEN];
  STUDENT *stuptr = 0;
  char line[MAX_LEN];
  
  stuptr = (STUDENT*)malloc(sizeof(STUDENT));
  
  
  FILE *fp = fopen("gpa.txt", "r");
  if(fp == NULL) {
      printf("Error in opening file\n");
      return 1;
  }
  
  while (fgets(line, sizeof(line), fp)) {
  
  ln++;
  if (sscanf(line, "%d %[^;]; %f ", &amp;id, name, &amp;gpa) &lt; 3) {
      printf("Syntax error in line %d.\n", ln);
  } else {
      printf("1 %4d  %-29s%f\n", id, name, gpa);
    }
   }
  
      stuptr-&gt;id = id;
      strcpy(stuptr-&gt;name, name);
      (stuptr-&gt;gpa) = gpa;
      return 0;
  }
  
  // Typedef
   typedef struct
  {
      int   id;
      char  name[MAX_NAME_LEN];
      float gpa;
  } STUDENT;
  </code></pre>