1、头文件: #include <sys/types.h>
#include <unistd.h>
2、函数原型: off_t lseek(int fd, off_t offset, int whence);
注释:
(1)int fd : 文件描述符
(2)off _t offset : 偏移值
负数:光标向前移动
正数:光标向后移动
零 : 位置保持不变
(3)int whence :固定点位置
此位置填写三个参数如下:
SEEK_SET : 指向文件头
SEEK_END : 指向文件尾
SEEK_CUR : 指向当前位置
3、返回值:调用成功后返回偏移值