Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!nrl-cmf!mailrus!tut.cis.ohio-state.edu!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon S. Allbery) Newsgroups: comp.unix.wizards Subject: Re: Getting the pathname from a FILE*. Message-ID: <11931@ncoast.UUCP> Date: 21 Jul 88 22:29:40 GMT References: <651@umb.umb.edu> <4531@csli.STANFORD.EDU> <1645@osiris.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon S. Allbery) Followup-To: comp.unix.wizards Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 19 As quoted from <1645@osiris.UUCP> by guest@osiris.UUCP (Guest account): +--------------- | It almost seems to me that this is a case which stdio is not designed to | handle. So - I'd say add another level of indirection. Write a routine | that acts like fopen() - and one that acts like fclose(), etc. Have it | store the name someplace, using only the "standard" interface to stdio, | and then write another routine, or macro, that allows you to get the | information back. I can't imagine that would be hard, and I expect it | will work a LOT faster than reading your file system. +--------------- But it won't work in the case of stdin, stdout, stderr -- which are implicitly fdopen()'ed from fd's 0, 1, and 2. And stdin is usually the one you want the name for. ++Brandon -- Brandon S. Allbery, uunet!marque!ncoast!allbery DELPHI: ALLBERY For comp.sources.misc send mail to ncoast!sources-misc