文件IO:lseek()
标准IO:fseek()
//#include <stdio.h>
//int fseek(FILE *stream, long offset, int whence);
#include <sys/types.h>
#include <unistd.h>
off_t lseek(int fd, off_t offset, int whence);
功能:
对相应的文件进行光标移动
参数:
fd:文件描述符
offset:偏移量
whence:光标的位置
SEEK_SET---文件的头部
SEEK_CUR---光标的当前位置
SEEK_END---文件末尾
返回值:
成功返回光标当前的位置
失败返回-1,并返回错误码