help-octave
[Top][All Lists]
Advanced

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

Re: How do I pass a file pointer to my octfile?


From: baba
Subject: Re: How do I pass a file pointer to my octfile?
Date: Sun, 26 Sep 2010 11:15:27 -0700 (PDT)

Thanks! I got the file pointer using your second "tricky method" using the
dynamic cast even though I do not really understand it I must say. But after
returning to the calling script, I cannot continue writing to that file. 

So in my octave script I can call myOctFunction (FID, ...) and myOctFunction
performs some writing to the file as expected. BUT when myOctFunction
function returns, it turns out that I can no longer write to the file using
fid. In other words in myOctaveScript.m I have something like this:

FID = fopen(myfile, 'w');
myOctFunction( FID, ...); %this works as expected and writes data to the
file

fprintf(FID, "some thing"); %does NOT write anything to the file
ftell(fid) %returns -1 !!


I have tried closing, reopening the file and position the pointer to the
end:
fclose(FID);
FID = fopen(myfile, 'w');
fseek(FID, SEEK_END);
ftell(fid) %returns 0! so it starts writing at the NEGINNING of the file not
the end.


Is there any way of still continue writing to the file from myOctaveScript
once myOctFunction(FID, ..) returns?

Thanks!

Baba

-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/How-do-I-pass-a-file-pointer-to-my-octfile-tp2551207p2714573.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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