for循环写入txt文件为什么重复二次,求助

如题:
gets(st);
for(i=0;i<1;++i){str[i]=st[0];}
st1[0]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[1];}
st1[1]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[2];}
st1[2]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[3];}
st1[3]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[4];}
st1[4]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[5];}
st1[5]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[6];}
st1[6]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[7];}
st1[7]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[8];}
st1[8]=ascii_to_integer(str);
for(i=0;i<1;++i){str[i]=st[9];}
st1[9]=ascii_to_integer(str);
FILE *fp;

fp=fopen("/storage/emulated/0/CCompiler/1123.txt","at");

if(fp==NULL)

{

printf("File cannot open! " );

exit(0);

}

for(i=0; i<10; ++i){
fprintf(fp,"%d\t",st1[i]);}

fclose(fp);

麻烦把问题,代码,格式化一下。完全没法看。