大家帮忙看下错在哪了?谢谢
#include<stdio.h>main()
{
int i;
char string[142][4];
float a[142],b[142],c[142];
FILE *fp;
if((fp=fopen("final.txt","r"))!=0)
{
for(i=0;i<142;i++)
{fscanf(fp," %c %f %f %f",string[i],a,b,c);
}
fprintf(fp,"%c %f %f %f\n",string[i],a,b,c);
}
fclose(fp);
fp=fopen("final.bs","w");
for(i=0;i<142;i++)
{
fprintf(fp,"%c %f %f %f\n",string[i],a,b,c);
fprintf(fp,"%c %f %f %f\n",string[i],a,b,c);
}
fprintf(fp,"\n\nspec C 0.300 0.100 0.100 0.500\n");
fprintf(fp,"\n\nspec H 0.200 0.100 0.500 0.500\n");
fprintf(fp,"bonds C C 0.000 1.500 0.0400 1.0 0.0 1.0\n");
fprintf(fp,"bonds H C 0.000 1.500 0.0400 1.0 0.0 1.0\n");
fprintf(fp,"\nscale 20\ninc 1.000");
fclose(fp);
}
这是一个实现输入和输出的程序在Linux上面、用.bs查看