微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 C 中使用 pread()

如何解决在 C 中使用 pread()

我试图使用 pread() 读取文件,但我得到“函数‘pread’的隐式声明在 C99 中无效”。有什么办法可以解决这个问题吗?

#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc,char **argv) 
{
        char dst[20];
        int file = open("file.txt",O_RDONLY);
        int read_res = pread(file,dst,10,3);
        close(file);
        return 0;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。