Mail Archives: djgpp/2001/09/28/06:49:24
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 -