为什么用stdin调用write()导致输出?

时间:2016-01-07 01:33:22

标签: c posix stdin

我能理解为什么写入stdout和stderr会有输出,但为什么stdin?

#include <unistd.h>

int
main()
{
  const char test[] = "test test test\n";
  write(STDIN_FILENO, test, sizeof(test) - 1);
  return 0;
}

编辑:对于那些想尝试一下的人,你可以compile and run the program here

0 个答案:

没有答案