From f819408a7e776379095cee7d3432d42dccdcaa6c Mon Sep 17 00:00:00 2001 From: OptionalAssistant <165001420+OptionalAssistant@users.noreply.github.com> Date: Fri, 29 Mar 2024 17:07:46 +0200 Subject: [PATCH] Enable to open file in ReadWrite mode --- src/zasm/src/core/filestream.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zasm/src/core/filestream.cpp b/src/zasm/src/core/filestream.cpp index 6384dca..2bc0f5d 100644 --- a/src/zasm/src/core/filestream.cpp +++ b/src/zasm/src/core/filestream.cpp @@ -88,9 +88,9 @@ namespace zasm FILE* fp = nullptr; #ifdef _WIN32 - _wfopen_s(&fp, path.wstring().c_str(), mode == StreamMode::Read ? L"rb" : L"wb"); + _wfopen_s(&fp, path.wstring().c_str(), mode == StreamMode::Read ? L"rb" : mode == StreamMode::Write ? L"wb" : L"r+b"); #else - fp = fopen(path.string().c_str(), mode == StreamMode::Read ? "rb" : "wb"); + fp = fopen(path.string().c_str(), mode == StreamMode::Read ? "rb" : mode == StreamMode::Write ? "wb" : "r+b"); #endif if (fp == nullptr) {