I have c-function interfaced via mex.
Inside this function several file streams are opened, content is
written using fprintf() and the files are closed.
Some file descriptors are defined within the function scope,
opened there, written there and closed there.
With these files all is fine.
But one file descriptor is declared globally, opened in one function,
written to in another and finally closed in the function, where it
has been opened.
The problem with this file is, that after a successful call of the
mex function, the file size is 0 bytes.
The file is opened with "w" and it has existed with content before.
So the file is opened and cleared as it should be.
But the content is yet not written to it, like it is done with the
Only if I close MATLAB the file is updated with the content i wrote
What could be the reason for this behavior?