Getting the pathname from a FILE*.

Brandon S. Allbery allbery at ncoast.UUCP
Fri Jul 22 08:29:40 AEST 1988


As quoted from <1645 at osiris.UUCP> by guest at 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



More information about the Comp.unix.wizards mailing list