Path: utzoo!attcan!uunet!zephyr.ens.tek.com!tektronix!sequent!paulr From: paulr@sequent.UUCP (Paul Reger) Newsgroups: comp.unix.wizards Subject: Re: how can I get filename from file descriptor? Message-ID: <20482@sequent.UUCP> Date: 22 Aug 89 00:29:33 GMT References: <20613@adm.BRL.MIL> <1019@virtech.UUCP> Reply-To: paulr@crg3.UUCP (Paul Reger) Organization: Sequent Computer Systems, Inc Lines: 17 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 *.