Before you start trying to store and analyse your data, you need to make sure you can reliably parse the line.
How you do this depends somewhat on how the fields are separated (fuzzy pictures of your files don't tell us anything useful).
The tricky part is dealing with names that have no consistent formatting.
Code:
#include<stdio.h>
#include<string.h>
size_t strlcpy(char *dest, const char *src, size_t size) {
strncpy(dest,src,size-1);
dest[size-1] = '\0';
}
int main()
{
char line1[] = "Abdul Rouf b. Ruslan AK021425 47 17 50 10 10 10 10 68\n";
char line2[] = "Abdul Rouf b. Ruslan\tAK021425\t47\t17\t50\t10\t10\t10\t10\t68\n";
char name[100], id[20];
// 1
sscanf(line1,"%30s%s",name,id); // doesn't work
printf(">>%s<< >>%s<<\n",name,id);
// 2
strlcpy(name,line1,30); // copy name manually, but with lots of extra spaces
sscanf(&line1[30],"%s",id); // start sscanf in the middle of line
printf(">>%s<< >>%s<<\n",name,id);
// 3
sscanf(line2,"%[^\t]%s",name,id);
printf(">>%s<< >>%s<<\n",name,id);
return 0;
}
$ gcc foo.c
$ ./a.out
>>Abdul<< >>Rouf<<
>>Abdul Rouf b. Ruslan << >>AK021425<<
>>Abdul Rouf b. Ruslan<< >>AK021425<<
Here are two examples of an input line
line1 has all the columns of data padded with spaces.
line2 has all the columns of data separated by tab characters.
So what you need to do is something like this initially.
Code:
while (fgets(std, sizeof(std), fListData))
{
char name[100], id[20];
sscanf(std,"%[^\t]%s",name,id);
printf(">>%s<< >>%s<<\n",name,id);
}
Experiment with the various ideas to get the name and ID copied out of the input line and into variables of your choice.
When you've got the name and ID being extracted successfully, try adding the extraction of T1,T2,T3 as well.
Getting the rest of the line is easy, an appropriate number of %d conversions will deal with those just fine.
The real trick is getting a reliable extraction of name and ID.
When your data extractor is working, then you can think about your StudentData and how to store, analyse and present your results.
> if (fListData == NULL | fResult == NULL)
This should use the || operator, not the | operator.