ask for input string but did not run

#include <stdio.h>
#include<conio.h>
int main()
{
char name[100];
int a,b,c,d,bil,i;
FILE *inp;
fopen("input.txt","w+");

printf("please insert how number of students\n=");
scanf("%d",&bil);

for(i=1;i<=bil;i++)
{
printf("please, enter a name: ");
gets (name);
fprintf(inp,"Name %d %s\n",i,name);
printf("please insert your 4 marks\n");
scanf("%d %d %d %d",&a,&b,&c,&d);
fprintf(inp,"\n%d %d %d %d",a,b,c,d);
}
printf("\nEND");
fclose(inp);
getch();
return 0;
}


i need to do a simple asignment in C(not c++) but encountered a problem...

asignment:
use a program to store data in FILE1 and then use another program to use the data in FILE1 to save new data in FILE2...
for example,save name and 4marks in FILE1 using program1, and then use program2 to use the data in FILE1 to calculate average and grade,then save the name,average and grade in FILE2...

the problem is,the name cannot be read...any sugestion?
and also,can anyone explain more about this file function?
because i dont understand fully how to use it...
for example,acording to my asignment,how do you use data from FILE1 and use it in program2?
Topic archived. No new replies allowed.