Mail Archives: djgpp/1995/04/21/23:12:19
> is there another way to check if output is to the screen/input from the
> keyboard?
Here's how I check whether input has been redirected:
Redirected = !(ioctl(0,0) & 0x80);
The first 0 is the handle (so for stdout, you would use ioctl(1,0)). The
second 0 means get device information. According to Ralf Brown's interrupt
list, the bit being tested indicates that the "file is remote (DOS 3+)".
Beyond this, I don't know why this code fragment works.
- Raw text -