On 03.09.2007, at 21:39, Vic Norton wrote:
On Sep 3, 2007, at 1:34 PM, Matthias Brennwald wrote:
Test 1. From terminal I execute
vic$ /Applications/Octave.app/Contents/Resources/bin/octave
This gets me into octave-2.9.13. Now I execute
octave-2.9.13> printf("%d\n", fopen ("~/desktop/
octave_output.txt", "wt"));
The output is
3
You've just opened the file with write access...
That's what I want to do, write to it.
Test 2. From terminal I execute
vic$ /usr/local/bin/octave
This gets me into octave-2.9.9. Now I execute
octave> printf("%d\n", fopen ("~/desktop/octave_output.txt",
"wt"));
The output is
-1
...and you're trying to open the same file with write access
again. I
guess that might explain why this second call to fopen is not
successful. Not sure, though.
This is a different shell and a different version of octave,
Matthias.
I know. But its the same file, and this file is in use with write
access by the first Octave (2.9.13). I guess its not a good idea to
open the same file twice with write access (but not sure). What would
happen if both Octaves would write to the file?
The -1 output tells me that I can't write to the octave_output.txt
file on my desktop because this octave (2.9.9) can't see it.
What do you mean by "can't see it"? The -1 simply means there has
been an error with opening the file.
What happens if you try to open the file with read access only?
Also, from reading 'help fopen', you will see that you can get an
error message back from fopen. Try...
[fid,msg] = fopen("~/desktop/octave_output.txt","wt")
...and check msg for a description of the error that occurs with
opening your file in Octave 2.9.9.
Matthias