目录
文件状态获取:(fstat)
定义:int fstat(int fd, struct stat *buf);
fd:句柄 buf:将文件状态信息复制给 buf
成功返回 0,失败:-1
结构体:buf.st_size:(获取文件大小函数)
文件读取光标位置移动:(lseek)
off_t lseek(int fd, off_t offset, int whence);
fd:句柄 offset:偏移量 whence:位置模式(SEEK_SET:设置当下)
文件读取:(pread)
(功能相似==lseek(...)+read(...))
定义:ssize_t pread(int fd, void *buf, size_t count, off_t offset);
注:不移动光标,lseek:移动光标

被折叠的 条评论
为什么被折叠?



