From 29fdcbab36c907f8d7dda4464b060e22d84915d8 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Tue, 10 Dec 2024 14:29:23 +0100 Subject: [PATCH] Update file handling --- cpp/s2psimh/s2psimh_core.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/s2psimh/s2psimh_core.cpp b/cpp/s2psimh/s2psimh_core.cpp index 7f85592d..e0643d8e 100644 --- a/cpp/s2psimh/s2psimh_core.cpp +++ b/cpp/s2psimh/s2psimh_core.cpp @@ -154,7 +154,7 @@ int S2pSimh::Run(span args) return EXIT_SUCCESS; } - simh_file.open(simh_filename, ios::in | ios::out | ios::binary); + simh_file.open(simh_filename, (meta_data.empty() ? ios::in : ios::out) | ios::binary); if (simh_file.fail()) { cerr << "Error: Can't open '" << simh_filename << "':" << strerror(errno) << endl; return EXIT_FAILURE;