help-octave
[Top][All Lists]
Advanced

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

Re: fprintf doesn't write "hello" to temporary file


From: Przemek Klosowski
Subject: Re: fprintf doesn't write "hello" to temporary file
Date: Fri, 23 Oct 2009 10:41:58 -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 09:56 AM, Aditya Bhagwat wrote:
Dear all,
fileName = sprintf('%s.sh', tmpnam());
fid = fopen(fileName, "w");
fprintf(fid, "hello\n");
fclose(fid);

Good so far...

cat(fileName)

.. but here you have a wrong cat. Check out Octave's help: 'help cat'
reveals that this is its array concatenation function, not the filesystem 'cat' command. Try one of those:

system(sprintf('cat %s',fileName))

system(['cat ' fileName])


reply via email to

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