Re: how to get the file name



On 2006-01-06, Tim Keck <timkeck@xxxxxxxxxxxxxx> wrote:

>>> only has the FILE * handle , how to get the file name ?
>>
>> You cannot.
>> Remember the filename when you opened it, if you can.
>>
>> (though linux has some not always reliable way, get the
>> filedescriptor with the fileno() function , call the readlink
>> function on the /proc/self/fd/<fd> fd file. Do a ls -l
>> /proc/self/fd to see what it's about)
>
> One of the beauties of the design is that there is a many to one
> relationship between directory entries and files, so a given file may
> have many names.

Or none.

--
Grant Edwards grante Yow! Here we are in
at America... when do we
visi.com collect unemployment?
.



Relevant Pages

  • Re: How to determine write failure?
    ... Synchronized I/O Data Integrity Completion (assured by fdatasync()) and ... The fact that the Linux fsync() manpage states it does not ensure directory ... it is not efficient to find the directory entries (there may be ...
    (comp.unix.programmer)
  • Re: "system" with [ ] in filename
    ... In a perl script I do this: ... Or should I look for the problem in the way Windows handles the in the filename? ... Come over and you make it work on Linux. ... I do not see your code where you transform/read/determine the filename to be written, but a simple routine to make it entirely unique - without the "" would not be out of the question here and would solve the overall problem - giving you time for submitting a bug report to the *magick folks. ...
    (comp.lang.perl.misc)
  • Re: Free FAT12/FAT16/FAT32 filesystem (C)
    ... There is an oddity about the vfat driver in Linux, ... prettify directory output by silently lowercasing 8.3 names when you ... IIRC if a filename you create COULD be represented ... it will always be preferred display. ...
    (comp.arch.embedded)
  • Regexp for parsing windows filepath on Unix
    ... I'm able to capture the file and move it over intact to my Linux box with no problem. ... I've discovered that when a user uploads the file with IE, the entire path to the file is sent (as opposed to FireFox which only returns the filename). ...
    (comp.lang.perl.misc)
  • Re: GDG like program?
    ... > I'm new to LInux and I'm wondering if there is a GDG (Genertaion Data ... storing generation numbers in the filename, ... Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org ...
    (comp.os.linux.development.apps)