- 论坛徽章:
- 0
|
大家先看看code吧~!
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/sendfile.h>
int main()
{
int s = open("tux", O_RDONLY);
int d = open("output", O_WRONLY | O_CREAT, 0600);
off_t off = 0;
ssize_t size = sendfile(d, s, &off, 10000);
if(size <= 0)
{
perror("sendfile");
}
printf("size = %d, off = %d\n", size, off);
}
编辑运行之后出错.
sendfile: Invalid argument
size = -1, off = 0
tux文件确实存在,而且是450M的文件.open应该没有错的.请大家帮忙看看!谢谢 |
|