help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get file info from file handle


From: Mike Miller
Subject: Re: How to get file info from file handle
Date: Tue, 20 Mar 2012 19:00:17 -0400

On Tue, Mar 20, 2012 at 5:35 PM, Philip Nienhuis <address@hidden> wrote:
> Nicholas Jankowski wrote:
>>
>> On Tue, Mar 20, 2012 at 3:34 PM, PhilipNienhuis<address@hidden>
>>  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'.

-- 
mike


reply via email to

[Prev in Thread] Current Thread [Next in Thread]