How to elegantly open or create new file for reading and writing but not discard existing contents?
0 Comments
Accepted Answer
4 Comments
The underlying languages of implementation, C and C++, do not support the mode you are requesting.
The calls that do support that mode, open(), is not part of C, and is instead a POSIX call https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html . That is a problem on Windows systems as Windows no longer supports POSIX.
I have not examined to find out if Windows supports the mode. MacOS and Linux potentially could, but Mathworks would have to specifically rewrite the code to use non-portable functions because it is not an available mode using portable functions.
More Answers (1)
4 Comments
MATLAB does not provide that combination of open permissions.
C's fopen() does not support that combination https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html and it has to instead be done through a C open() call followed by a call to upgrade the resulting file descriptor into a file*
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!