Path: utzoo!attcan!uunet!husc6!uwvax!rutgers!gatech!ulysses!cjc From: cjc@ulysses.homer.nj.att.com (Chris Calabrese[rs]) Newsgroups: comp.unix.wizards Subject: Re: Getting the pathname from a FILE*. Summary: why should a FILE* point to a file? Keywords: sockets pipes etc Message-ID: <10432@ulysses.homer.nj.att.com> Date: 9 Jul 88 20:15:24 GMT References: <651@umb.umb.edu> Organization: AT&T Bell Laboratories, Murray Hill Lines: 27 In article <651@umb.umb.edu>, karl@umb.umb.edu (Karl Berry.) writes: > > The title says it all. Am I missing something obvious? > The pathname doesn't seem to be a field in either the > _iobuf or the structure returned by stat. > ttyname or ctermid will give you the pathname > of your terminal, but I want the pathname of an > arbitrary FILE* I have fopen. Or am I missing some > reason why this is not feasible? If _you_ have fopened the file, then _you_ already know what the name is (just have it sitting around in your program), but if the file is inheritted(sp?) how do you even know it's a file??? If you rsh or rlogin, then the stdin to any process created on the remote machine is a socket (mabee it's something similar, but you get the idea), or a stream (ditto) for sysV. Even if you don't have any kind of a network, then stdin could be a pipe, which has no name for unnamed pipes. These are, infact, files in most versions of sysV, but they have no names, just inodes. -- Christopher Calabrese AT&T Bell Laboratories ulysses!cjc