You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,it seems there is a bug that does not allow to open file descriptor in read&write mode despite we have StreamMode::ReadWrite enum value.The problem in the following line of FileStream::open function _wfopen_s(&fp, path.wstring().c_str(), mode == StreamMode::Read ? L"rb" : L"wb");.The problem if we pass ReadWrite enum value to FileStream::open method or to constructor it open the file in wb mode and overwrites the content.It is not the problem for load and store func cause as I understood there is no sence to pass FileStream in ReadWrite value to save func cause it has to clear the content before writing bytes using his own patterns.But it is problem for user who wants to use FileStream as a wrapper to work with files cause he is not able to open file in rw mode using FileStream.I could create pull request but I can not firgure out how to fix it to not break load and store func.
P.S.As an option we can write something like this _ _wfopen_s(&fp, path.wstring().c_str(), mode == StreamMode::Read ? L"rb" : mode == StreamMode::Write ? L"wb" : L"r+b");
but it will break save func cause file will not be cleared before writing our Program;
The text was updated successfully, but these errors were encountered:
Hello,it seems there is a bug that does not allow to open file descriptor in read&write mode despite we have StreamMode::ReadWrite enum value.The problem in the following line of FileStream::open function
_wfopen_s(&fp, path.wstring().c_str(), mode == StreamMode::Read ? L"rb" : L"wb");
.The problem if we pass ReadWrite enum value to FileStream::open method or to constructor it open the file in wb mode and overwrites the content.It is not the problem for load and store func cause as I understood there is no sence to pass FileStream in ReadWrite value to save func cause it has to clear the content before writing bytes using his own patterns.But it is problem for user who wants to use FileStream as a wrapper to work with files cause he is not able to open file in rw mode using FileStream.I could create pull request but I can not firgure out how to fix it to not break load and store func.P.S.As an option we can write something like this
_ _wfopen_s(&fp, path.wstring().c_str(), mode == StreamMode::Read ? L"rb" : mode == StreamMode::Write ? L"wb" : L"r+b");
but it will break save func cause file will not be cleared before writing our Program;
The text was updated successfully, but these errors were encountered: