본문내용
/화일처리
#include
#include
void printhead();
int main()
{
char fname[]="grade.txt";
char names[80];
FILE *f;
int point1, point2, cnt=0;
if((f=fopen(fname,"w")) == NULL){
printf("안열림");
exit(1);
};
printf("이름_성적1_성적2 입력\n");
fgets(names,80,stdin);
while(!feof(stdin)){
fprintf(f,"%d",++cnt);
fputs(names,f);
fgets(names,80,stdin);
}
fclose(f);
if((f=fopen(fname,"r")) == NULL){
printf("안열림");
exit(1);
};
#include
#include
void printhead();
int main()
{
char fname[]="grade.txt";
char names[80];
FILE *f;
int point1, point2, cnt=0;
if((f=fopen(fname,"w")) == NULL){
printf("안열림");
exit(1);
};
printf("이름_성적1_성적2 입력\n");
fgets(names,80,stdin);
while(!feof(stdin)){
fprintf(f,"%d",++cnt);
fputs(names,f);
fgets(names,80,stdin);
}
fclose(f);
if((f=fopen(fname,"r")) == NULL){
printf("안열림");
exit(1);
};