[Top][All Lists]

[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

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
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?



View this message in context:
Sent from the Octave - General mailing list archive at

reply via email to

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