您的位置:首页 > 运维架构 > Linux

LINUX标准io默认都是阻塞的

2011-12-21 11:31 232 查看
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main()
{
int s_in, s_out, s_err;
s_in= fcntl(STDIN_FILENO, F_GETFL);
s_out= fcntl(STDOUT_FILENO, F_GETFL);
s_err= fcntl(STDERR_FILENO, F_GETFL);
if (O_NONBLOCK == s_in)
printf("stdin is nonblock\n");
else
printf("stdin is block\n");
if (O_NONBLOCK == s_out)
printf("stdout is nonblock\n");
else
printf("stdout is block\n");
if (O_NONBLOCK == s_err)
printf("stderror is nonblock\n");
else
printf("stderror is block\n");

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐