【问题标题】:What's the int macro for stdin?stdin 的 int 宏是什么?
【发布时间】:2011-09-28 19:59:37
【问题描述】:

stdin 的类型为 FILE *

是否有 fd 宏?

还是需要我自己转换?

【问题讨论】:

  • 你可以“猜到”stdin <==> 0; stdout <==> 1; stderr <==> 2
  • 无需猜测 - POSIX 要求这样做,因此您可以合法地使用数字。

标签: c macros stdin


【解决方案1】:

【讨论】:

    【解决方案2】:

    STDIN_FILENO 来自unistd.h

    【讨论】:

      【解决方案3】:

      以下是标准流的整数文件描述符:

      • 0stdin
      • 1stdout
      • 2stderr

      【讨论】:

        猜你喜欢
        • 2014-04-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-05-15
        • 2014-09-30
        • 1970-01-01
        • 1970-01-01
        • 2014-12-30
        相关资源
        最近更新 更多