⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 no_redir.c

📁 不错书对C++/C程序员很有用的大家不要错过.
💻 C
字号:
#include <stdio.h>
#include <dos.h>

void main(void)
  {
     union REGS inregs, outregs;

     // check the stdin handle first
     inregs.x.ax = 0x4400;
     inregs.x.bx = 0;      // stdin is handle 0
     intdos (&inregs, &outregs);

     if ((outregs.x.dx & 1) && (outregs.x.dx & 128))
       fprintf (stderr, "stdin has not been redirected\n");
     else
       fprintf (stderr, "stdin is redirected\n");                      

     // Now check stdout
     inregs.x.ax = 0x4400;
     inregs.x.bx = 1;      // stdout is handle 1
     intdos (&inregs, &outregs);

     if ((outregs.x.dx & 2) && (outregs.x.dx & 128))
       fprintf (stderr, "stdout has not been redirected\n");
     else
       fprintf (stderr, "stdout is redirected\n");                      
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -