为什么最后i=5时,i*6L=30L,
此时输出的仍然是19,而不是报错或是输出20什么的
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i,n;
FILE *fp;
if((fp=fopen("temp","w+"))==NULL)
{
printf("can not set temp file\n");
exit(0);
}
for(i=1;i<=10;i++)
fprintf(fp,"%3d",i);
for(i=0;i<10;i++)
{
fseek(fp,i*3L,0);
fscanf(fp,"%d",&n);
fseek(fp,i*3L,0);
fprintf(fp,"%3d",n+10);
}
for(i=1;i<=5;i++)
{
fseek(fp,i*6L,0);
fscanf(fp,"%d",&n);
printf("%3d",n);
}
fclose(fp);
return 0;
}
最后那个fprintf里是不是少了个%百分号!