gpt4 book ai didi

c - 为什么 'EINTR' 未声明?

转载 作者:太空宇宙 更新时间:2023-11-04 05:16:43 24 4
gpt4 key购买 nike

<分区>

我包括了 <error.h> .

#include <error.h>
#include <unistd.h>

ssize_t rio_readn(int fd, void *buf, size_t n)
{
size_t nleft = n;
char *rbuf = buf;
while(nleft > 0)
{
int nread = read(fd, rbuf, nleft);
if(nread < 0)
{
if(error == EINTR)
nread = 0;
else
return -1;
}
else if(nread == 0)
break;
nleft -= nread;
rbuf += nread;
}
return n - nleft;
}

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com