23,121
社区成员
发帖
与我相关
我的任务
分享
#include "fcntl.h"
int flags;
//set nonblock:
if(flags = fcntl(fd,F_GETFL, 0 ) < 0)
{
;//errror
}
else
{
;//ok
}
flags |= O_NONBLOCK;
if(fcntl(fd, F_SETFL, flags) < 0 )
{
;//error
}
//set block:
flags &= ~O_NONBLOCK;
if(fcntl(fd, F_SETFL, flags) < 0 )
{
;//error
}