Mail Archives: djgpp/1997/03/01/06:38:20

From: Brian Osman <osmanb AT rpi DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Is stdout the console?
Date: Fri, 28 Feb 1997 11:11:24 -0500
Organization: Rensselaer Polytechnic Institute, Troy NY, USA
Lines: 27
Message-ID: <>
References: <01IFXYQFJ23Q00I1MD AT cc DOT uab DOT es>
Reply-To: osmanb AT rpi DOT edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

> I need to know if stdout is the console, i.e., if it has not been
> redirected to a file through
> In TC, I do it by checking the field "flag" of the FILE structute associated
> with stdout: if stdout is the console, this flag indicates _F_TERM.
> In DJGPP the FILE structure semms to be different and I cannot find this
> flag. In fact, if you know some other portable way to know if stdout is the
> console or a file it will also be useful to me.
> Thanks in advance!
> XP

Hmmm. Right now I can't think exactly what you'd look for, but I'm sure
you could figure it out somehow with stat(). I was thinking you could
try opening it for read only, but I've heard from some people that
(at least on some systems) stdout and stdin can both be opened the
wrong way... :) Try stat() and checking some of the different flags
for file types, and see what you get when it is/isn't redirected. (Or,
write soemthing and look in the video memory for it. Ouch, that's an
evil suggestion.)


- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019