没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
示例程序如下:
main(){
char s[100];
FILE * fp = fopen("./file","r");
while(1)
{
printf("the file point before fgets is %d\n",ftell(fp));
fgets(s,100,fp);
printf("the file point after fgets is %d\n",ftell(fp));
printf("%s",s);
if(feof(fp))
break;
}
fclose(fp);
}
文件file的内容如下:
hello world first
hello world second
程序的运行结果如下:
the file point before fgets is 0
the file point after fgets is 18
hello world first
the file point before fgets is 18
the file point after fgets is 37
hello world second
the file point before fgets is 37
the file point after fgets is 37
hello world second
main(){
char s[100];
FILE * fp = fopen("./file","r");
while(1)
{
printf("the file point before fgets is %d\n",ftell(fp));
fgets(s,100,fp);
printf("the file point after fgets is %d\n",ftell(fp));
printf("%s",s);
if(feof(fp))
break;
}
fclose(fp);
}
文件file的内容如下:
hello world first
hello world second
程序的运行结果如下:
the file point before fgets is 0
the file point after fgets is 18
hello world first
the file point before fgets is 18
the file point after fgets is 37
hello world second
the file point before fgets is 37
the file point after fgets is 37
hello world second
资源评论
- Asia07242014-04-22问题已解决,谢谢楼主!
- 这是什么呀2014-05-22问题已解决,谢谢楼主!
zhongzhi0507
- 粉丝: 1
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功