fseek for fd(int fd而不是FILE*)

Cen*_*noc 8 c file

是否有相当于fd的fseek?我一直在使用int fds很长一段时间,并想使用fseek ...但我知道没有搜索功能.

提前致谢!

Joh*_*ica 12

查看POSIX函数lseek(2):

概要

#include <unistd.h>

off_t
lseek(int fildes, off_t offset, int whence);
Run Code Online (Sandbox Code Playgroud)

描述

lseek()函数根据指令将文件描述符的偏移量重新定位fildes到参数.参数必须是一个打开的文件描述符.offsetwhencefildes

  • @R ..:John Lion的UNIX V6 Source(在线发现)确实表明版本6只有`seek`取'int`偏移量.版本7手册(也在网上找到)显示没有"寻找"在视线中,而是"lseek"显示"长"偏移.我也会猜测,但你的猜测似乎对我好. (5认同)