用fprintf函数向文件输入一个结构体数组(结构体数组内容是学生学号、姓名、五门课成绩),我怎么实现换行啊

[复制链接]
查看11 | 回复1 | 2012-6-20 17:41:31 | 显示全部楼层 |阅读模式
在这只做简单的解释!假设有3个学生:FILE *fp; int i; if((fp=fopen(fp,"w"))==NULL) {printf("Cannot open the file!");exit(0); } for(i=0;i<3;i++) {fprintf(fp,"%d%s%f%f%f%f%f\n",struct.num,struct.name,struct.score[0],struct.score[1],struct.score[2],struct.score[3],struct.score[4]) ; }这里仅是简写,结构体的定义自己定义!这里...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行