獲取文件的讀寫位置::ftell(3)//這一函數為庫函數
操作文件的讀寫位置:lseek(2)
#include<sys/types.h>
#include<unistd.h>
off_t? ? lseek(int fd,off_t offset,int whence);
功能:重新定位文件的讀寫位置
參數:
? ? fd:open(2)的返回值,指定了操作的文件
? ? offset:相對whence參數的偏移
? ? whence:
? ? ? ? SEEK_SET:文件的頭部
? ? ? ? SEEK_CUR:文件的當前位置
? ? ? ? SEEK_END:文件的尾部
返回值
? ? ? ?錯誤:-1惹想,errno被設置
? ? ? ? 成功:相對文件頭部的偏移字節(jié)數