It creates the temp file containing the required result. but its not removing the previous file "records.txt" and not renaming temp.txt. im using dev c++.
void delete()
{
FILE *fp, *ft;
int no;
char ch;
student stud;
fp = fopen("Records.txt","r");
printf("\nEnter student's RollNo to delete:");
scanf("%d",&no);
ft = fopen("temp.txt","w+");
while (!feof(fp))
{
fscanf(fp, "\n%d\t%s\t", &stud.roll_no, stud.name);
if (stud.roll_no != no)
{
fprintf(ft, "\n\t%d \t%s", stud.roll_no, stud.name);
}
}
fclose(fp);
fclose(ft);
remove("Records.txt");
rename("temp.txt","Records.txt");
}