[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get file info from file handle
From: |
PhilipNienhuis |
Subject: |
Re: How to get file info from file handle |
Date: |
Tue, 20 Mar 2012 16:28:33 -0700 (PDT) |
Mike Miller-2 wrote
>
> On Tue, Mar 20, 2012 at 5:35 PM, Philip Nienhuis <pr.nienhuis@>
> wrote:
>> Nicholas Jankowski wrote:
>>>
>>> On Tue, Mar 20, 2012 at 3:34 PM, PhilipNienhuis<pr.nienhuis@>
>>> wrote:
>>>>
>>>> Is it possible to get some file info (e.g., file name) from a file
>>>> handle
>>>> returned by fopen?
>>
>>
>>> assuming you did a fopen("all") or something that means you don't have
>>> the filename in the firstplace. If you do a fopen(fid) it will give
>>> you back info about the file. Otherwise, there's some stuff in the
>>> Octave user manual (octave.pdf) section on System Utilities /
>>> Filesystem Utilities. In particular I see fileattrib and stat. stat
>>> works of a 'file' or 'fid'. it only mentions a 'file' for fileattrib.
>>
>>
>> Thanks, I didn't spot that section (my bad).
>>
>> Unfortunately no way yet to recover the file name.....
>
> Try
>
> name = fopen(fd)
>
> should return the original name you opened it with. This is
> documented in 'help fopen'.
>
Thanks, just what I needed.
Sorry I've overlooked that one too.... :-(
Philip
--
View this message in context:
http://octave.1599824.n4.nabble.com/How-to-get-file-info-from-file-handle-tp4490118p4490741.html
Sent from the Octave - General mailing list archive at Nabble.com.