1个回答
2011-12-15
展开全部
#include<stdio.h>
void main()
{
FILE *fp;
int i,a,b,c[5];
char str[100];
if((fp=fopen("text.txt","rt"))==NULL)
{
printf("cannot open file\n");
return;
}
fgets(str,100,fp);
fscanf(fp,"%d%d\n",&a,&b);
for(i=0;i<5;i++)
fscanf(fp,"%d\n",&c[i]);
fclose(fp);
}
void main()
{
FILE *fp;
int i,a,b,c[5];
char str[100];
if((fp=fopen("text.txt","rt"))==NULL)
{
printf("cannot open file\n");
return;
}
fgets(str,100,fp);
fscanf(fp,"%d%d\n",&a,&b);
for(i=0;i<5;i++)
fscanf(fp,"%d\n",&c[i]);
fclose(fp);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询