I'm having a file that contain the following:
12345678 abeer ahmed 2007 16-6-1989 8 9 ds121#
that line repeated for different names and ids i nedd to sort this lines by gpa how which in that line = 8 how can i do it

Where in that line does GPA appear? After reading the line from the file, move gpa to the beginning of the line to make sorting faster and easier. You could also copy gpa into a different array to make sorting much faster.

struct line
{
    char gpa[5];
    char ln[80];
};

when reading the file, build an array of the above structure, then sort the structures by gpa field.