[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: name of file created by tmpfile()
From: |
Przemek Klosowski |
Subject: |
Re: name of file created by tmpfile() |
Date: |
Fri, 23 Oct 2009 11:20:10 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4 |
On 10/23/2009 10:34 AM, Aditya Bhagwat wrote:
[fid,msg] = tmpfile()
fprintf(fid, "hello");
Is there any way of finding out the name of the file to which "hello"
has been written? I do know the file identifier (stored in fid), but
don't know the file name.
If you want the name, use tmpname() and fopen(), for instance like this:
fopen(fname=tmpnam(),'w')
By the way, on Linux you can tease out the name of a file by the file
descriptor number:
system(['ls -l /proc/$$/fd/' num2str(fid)])