小编Fer*_*iho的帖子

stdin 和 stdout 实际上是同一个文件吗?

我很困惑,stdin、stdout 和 stderr 是否有可能在内部指向同一个文件描述符?因为如果我使用 stdin 作为输入或 stdout,如果我想从控制台读取字符串,它在 C 中没有区别。

read(1, buf, 200)read(0, buf, 200)怎么可能?

( 0 == STDIN_FILENO == fileno(stdin),
1 == STDOUT_FILENO == fileno(stdout))

c linux stdin stdout io-redirection

4
推荐指数
1
解决办法
954
查看次数

标签 统计

c ×1

io-redirection ×1

linux ×1

stdin ×1

stdout ×1