完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
1个回答
|
|
在BT代码的缓冲管理中经常会看到这函数,功能是移动文件的读写指针,可以先在Linux的Sheel下看一下他的函数原型:
NAME lseek - reposition read/write file offset SYNOPSIS #include #include off_t lseek(int fd, off_t offset, int whence); DESCRIPTION The lseek() function repositions the offset of the open file associated with the file descriptor fd to the argument offset according to the directive whence as follows: SEEK_SET The offset is set to offset bytes. SEEK_CUR The offset is set to its current location plus offset bytes. SEEK_END 参数说明: fd为已打开的文件描述符; off_t_offset为偏移量,它是根据下面的whence的取值; whence有3种取值: SEEK_SET 将读写位置指向文件头后增加offset个位移量; SEEK_CUR 以目前的读写位置往后增加offset个位移量; SEEK_END 将读写位置指向文件尾后增加offset个位移量; 但是有时候,在旧的代码中可能看到不是SEEK_XXX这样的参数,这是由于新旧值的原因,下面是他们的对应关系: 旧值 新值 0 SEEK_SET 1 SEEK_CUR 2 SEEK_END L_SET SEEK_SET L_INCR SEEK_CUR L_XTND SEEK_END |
|
|
|
只有小组成员才能发言,加入小组>>
11858 浏览 2 评论
4284 浏览 3 评论
3468 浏览 5 评论
8546 浏览 47 评论
4066 浏览 9 评论
449浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-25 23:52 , Processed in 0.444274 second(s), Total 48, Slave 40 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号