[Israel.pm] how to get fullpath of file from

Gaal Yahas gaal at forum2.org
Thu Jul 15 04:30:25 PDT 2004


On Thu, Jul 15, 2004 at 02:06:19PM +0300, Itamar Elem wrote:

> how do i get file full path from
> 1. file handle
> 2 from relative path
> in c++ on unix

Not really related to Perl, is this?

Anyway:

1. There is no standard way to do this. You can try your luck with /proc
   but this isn't going to be portable, and you can't even rely on it
   existing. (On my system, ls -l /proc/768/fd gives the open files of
   process 768.)

   You should note, though, that although open(2) takes a pathname as an
   argument, on unix a file may have several names.

2. You'll have to write code to do that (or use somebody else's code).
   AFAIK there's no standard library call to absoloutify a path.

-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/



More information about the Perl mailing list