how can I get filename from file descriptor?

Paul Reger paulr at sequent.UUCP
Tue Aug 22 10:29:33 AEST 1989


The solutions to this problems are very dissatisfying.  I think the
object oriented approach should be adopted here to file operations.
What I mean is this:

modify fopen() and the FILE structure in the following ways:

Have the FILE structure have a name field in it:

    char *name;

then when the fopen() call is made, have it fill in the field, by
malloc() and strcpy() and determine the actual name based on the
current working directory and the name passed as a parameter to
fopen().  Thereafter the *name field can be referenced directly from
the FILE, or preferably a new function:  TheName() can be made which
takes a FILE argument and returns the char *.



More information about the Comp.unix.wizards mailing list