Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define MAX 200




void getinfoStudent();
void prompt();
void printstudentInfo();
void addstudentInfo();
void printpartial();
int compare();
void update();


struct Student
{
    char firstname[30];
    char lastname[30];
    int studentnumber;
    int markFinal;
    int markMidterm;
    int markAssignment[5];
    int markLab[5];


}student[MAX];






int main()
{
prompt();
return 0;
}




void prompt()
{
    int choice, flag = 1 ;


printstudentInfo();
printf("\n");


    printf("Please choose an option:\n");
    printf("  1. View the information for a specific student\n");
    printf("  2. Add a new student\n");
    printf("  3. Exit\n");
    printf("What is your choice? :");
    scanf("%d",&choice);


    while(flag)
    {
        switch(choice)
        {
        case 1:
            getinfoStudent();
            break;
        case 2:
            system("cls");
            addstudentInfo();
            break;
        case 3:
            exit(0);
            break;


        default:
        printf("Invalid choice. Please try again.\n");
        printf("Press any key to continue.\n");
        getch();
        system("cls");
        prompt();
        }
    }


}




void getinfoStudent()
{
    system("cls");
printpartial();
}




void printstudentInfo()
{
int i;
FILE *fp;
   printf("F Name  L Name  Student# A1  A2  A3  A4  A5  L1  L2  L3  L4  L5  Midterm  Final\n");
   printf("________________________________________________________________________________\n");
fp = fopen("studentinfo.txt","r");


 if (fp == NULL)
    {
         printf("I couldn't open studentinfo.txt for printing.\n");
         exit(0);
    }


    for(i = 0; i< MAX; i++)
    {
while (fscanf(fp, "%s %s %d %d %d %d %d %d %d %d %d %d %d %d %d\n", student[i].firstname, student[i].lastname,&student[i].studentnumber,
              &student[i].markAssignment[0],&student[i].markAssignment[1],&student[i].markAssignment[2],&student[i].markAssignment[3],
              &student[i].markAssignment[4],&student[i].markLab[0],&student[i].markLab[1],&student[i].markLab[2],&student[i].markLab[3],
              &student[i].markLab[4],&student[i].markMidterm,&student[i].markFinal)== 15)


    printf("%s %s  %d  %d %d %d %d %d %d %d %d %d %d %d %d\n",student[i].firstname, student[i].lastname,student[i].studentnumber,
           student[i].markAssignment[0],student[i].markAssignment[1],student[i].markAssignment[2],student[i].markAssignment[3],
           student[i].markAssignment[4],student[i].markLab[0],student[i].markLab[1],student[i].markLab[2],student[i].markLab[3],
           student[i].markLab[4],student[i].markMidterm,student[i].markFinal);
    }


fclose(fp);


}




void printpartial()
{
int i,studentnum,flag = 1;
FILE *fp;


fp = fopen("studentinfo.txt","r");


 if (fp == NULL) {
         printf("I couldn't open studentinfo.txt for printing.\n");
         exit(0);
      }


while (flag)
{


printf("Please type the student number to look at the student's information: ");
scanf("%d",&studentnum);




 for (i = 0;i<MAX;i++)
    {
        while (fscanf(fp, "%s %s %d %d %d %d %d %d %d %d %d %d %d %d %d\n", student[i].firstname, student[i].lastname,&student[i].studentnumber,
              &student[i].markAssignment[0],&student[i].markAssignment[1],&student[i].markAssignment[2],&student[i].markAssignment[3],
              &student[i].markAssignment[4],&student[i].markLab[0],&student[i].markLab[1],&student[i].markLab[2],&student[i].markLab[3],
              &student[i].markLab[4],&student[i].markMidterm,&student[i].markFinal)== 15)
    if (studentnum == student[i].studentnumber) // finding whether the colour is invalid or not
    {
      printf("\nF Name  L Name  Student# A1  A2  A3  A4  A5  L1  L2  L3  L4  L5  Midterm  Final\n");
   printf("________________________________________________________________________________\n");
            printf("%s %s %d %d %d %d %d %d %d %d %d %d %d %d %d\n",
                   student[i].firstname,student[i].lastname,student[i].studentnumber,student[i].markAssignment[0],
                   student[i].markAssignment[1],student[i].markAssignment[2],student[i].markAssignment[3],student[i].markAssignment[4],
                   student[i].markLab[0],student[i].markLab[1],student[i].markLab[2],student[i].markLab[3],student[i].markLab[4],student[i].markMidterm, student[i].markFinal);


     fclose(fp);


     printf("\n Please press key to continue. ");
     getch();
     system("cls");
     prompt();
    }
    else
    {
        flag = 1;
    }
    }


if(flag == 1)
    {
             printf("Invalid student number. Please type it again.\n");
            getch();
            getinfoStudent();
    }
}


}






void addstudentInfo()
{
char first[30],last[30];
int stunum,a1,a2,a3,a4,a5,l1,l2,l3,l4,l5,m,f,ch,ln;
FILE *fp;


fp = fopen("studentinfo.txt","a+");


 if (fp == NULL)
    {
         printf("I couldn't open studentinfo.txt for printing.\n");
         exit(0);
    }


ch = 1;
while(ch)
{
    printf("What is the student's first name? :");
    scanf("%s",first);


    printf("What is the student's last name? :");
    scanf("%s",last);


    printf("What is the student number? :");
    scanf("%d",&stunum);


char s1[50] = "What is the student's Assignment 1 mark? :";
a1 = compare(s1);
char s2[50] = "What is the student's Assignment 2 mark? :";
a2 = compare(s2);
char s3[50] = "What is the student's Assignment 3 mark? :";
a3 = compare(s3);
char s4[50] = "What is the student's Assignment 4 mark? :";
a4 = compare(s4);
char s5[50] = "What is the student's Assignment 5 mark? :";
a5 = compare(s5);
char s6[50] = "       What is the student's Lab 1 mark? :";
l1 = compare(s6);
char s7[50] = "       What is the student's Lab 2 mark? :";
l2 = compare(s7);
char s8[50] = "       What is the student's Lab 3 mark? :";
l3 = compare(s8);
char s9[50] = "       What is the student's Lab 4 mark? :";
l4 = compare(s9);
char s10[50] = "       What is the student's Lab 5 mark? :";
l5 = compare(s10);
char s11[50] = "     What is the student's Midterm mark? :";
m = compare(s11);
char s12[50] = "       What is the student's Final mark? :";
f = compare(s12);


    fprintf(fp,"\n%s %s %d %d %d %d %d %d %d %d %d %d %d %d %d\n",first,last,stunum,a1,a2,a3,a4,a5,l1,l2,l3,l4,l5,m,f);
    printf("\nStudent information is succesfully added.\n\n");


    printf("Added Student\n");
    printf("          Name: %s %s\nStudent Number: %d\n",first,last,stunum);


    printf("\npress 1 to continue adding student info or 0 to exit: ");
    scanf("%d",&ln);
    ch = ln;
    system("cls");
    }
fclose(fp);
prompt();
}






int compare(char st[50])
{
    int a;
    int flag = 1;


while(flag)
{
    printf("%s",st);
    scanf("%d",&a);


    if(a > 120 || a < 0)
{
    printf("Invalid mark. Please enter again\n");
    flag = 1;
}
else
{
        flag = 0;
}
}
    return a;
}




void update()
{


}
Inside of my studentinfo.txt file
Code:
Jnh Has 2353325 23 56 72 34 67 22 46 42 5 23 56 23
Daniel Laurent 6744590 10 20 30 40 50 60 70 80 90 100 40 50
This code is working totally fine. Right now, I'm trying to update a specific data from the student info.
Let's say I'm trying to update my student number of Daniel.
So, in this case, I want to replace 6744590 to some other student number.
I think I have to use fseek() or rewind() and use fputs() but, I don't know how I should decide where to look.
Could anyone suggest any ideas?