LINUX标准io默认都是阻塞的

#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");

}


你可能感兴趣的:(linux,IO,include)