c - 在 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;
}
解决方案
推荐阅读
- python - 从大型 Python 列表中删除大量元素,同时保留元素的顺序
- algorithm - 用递归和堆栈构建计算器,总是用括号'()'得到错误的结果,这是怎么回事
- apache-spark - 如何在 PySpark 中找出组中列的唯一元素数?
- hybris - 如何向 Hybris OOTB 目录感知模型添加不可同步的属性?
- laravel - Laravel Pluck 3 数组
- mysql - MySQL JOIN 与 count / distinct
- kotlin - 如何在 Kotlin 中使用 jssc?
- docker - Gitlab runner ECS fargate 构建 docker 镜像
- python - 模板中没有表单的Django数据保存模型
- firebase - Firebase 无密码:我可以先使用自定义声明创建一个帐户吗?