|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: fprintf doesn't write "hello" to temporary fileDear all,
> fileName = sprintf('%s.sh', tmpnam()); > fid = fopen(fileName, "w"); > fprintf(fid, "hello\n"); > fclose(fid); > cat(fileName) > > For some reason the file remains empty and no "hello" is present in > it. Any idea what is happening here? I should add that I am working on octave 3.2.3, compiled on Ubuntu 9.04. I am calling octave from within emacs 23.1. Regards and many thanks for your help, Aditya _______________________________________________ Help-octave mailing list Help-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: fprintf doesn't write "hello" to temporary fileDear all,
>> fileName = sprintf('%s.sh', tmpnam()); >> fid = fopen(fileName, "w"); >> fprintf(fid, "hello\n"); >> fclose(fid); >> cat(fileName) >> >> For some reason the file remains empty and no "hello" is present in >> it. Any idea what is happening here? > > I should add that I am working on octave 3.2.3, compiled on Ubuntu > 9.04. I am calling octave from within emacs 23.1. using the 'cat' function. The cat function is meant to concatenate vectors in octave, I mistakenly took it for the linux cat function to display the contents of a file. Regards, Aditya _______________________________________________ Help-octave mailing list Help-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/help-octave |
|
|
Re: fprintf doesn't write "hello" to temporary fileOn 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]) _______________________________________________ Help-octave mailing list Help-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/help-octave |
| Free embeddable forum powered by Nabble | Forum Help |