www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/28/06:49:24

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: getting redir-ed Filename?
Date: 28 Sep 2001 10:35:47 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 22
Message-ID: <9p1jq3$445$1@nets3.rz.RWTH-Aachen.DE>
References: <bgu7rtgub4j1cf8lea2s1enub6ec7hfhmu AT 4ax DOT com>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1001673347 4229 137.226.32.75 (28 Sep 2001 10:35:47 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 28 Sep 2001 10:35:47 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Radical wrote:

> Is it possible for a program to obtain the name used on the command
> line of a redirected filename?

If so, then only in a highly unportable, and probably fragile way: it
might be doable in raw DOS, but probably not in Windows NT.

I.e. unless you're 100% sure you have to do it, don't.

stdin is supposed to be an "opaque" stream. I.e. it's none of your
program's business to know where it came from, besides knowing the
generaly type of file or device sitting on the other end --- which is
what you have isatty() for.

The only instance that really knows what filename belongs to a given
file handle is the operating system.  In raw DOS, you *can* use
undocumented methods to access the system file table and read out that
type of information.  In NT or 2K, I seem to remember you can't.
-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


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