程序很简单,写了一个lzw文件,然后
用fseek将指针放在第i个字节,ftell返回值i+1
但是到了第290个字节,ftell返回802.这是为什么?

为什么fseek设置的值与ftell返回值不同?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
4条回答 默认 最新
- Heart09 2015-05-07 02:59关注
首先,贴上这几个函数的返回值 man内容
The rewind() function returns no value. Upon successful completion, fgetpos(), fseek(), fsetpos() return 0, and ftell() returns the current offset. Otherwise, -1 is returned and errno is set to indicate the error.
另外,fseek的第三个参数,是否用对了 SEEK_SET, SEEK_CUR, SEEK_END
分别是距离开始位置、当前位置、结尾位置 的seek定位offset本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报