From 7f3f0d1201ce74d8bf0e0b5aec9d9ec7bf1a3e49 Mon Sep 17 00:00:00 2001 From: "Dr. Patrick Urbanke" Date: Sat, 6 Dec 2025 14:03:34 +0100 Subject: [PATCH] Place after open --- include/rfl/io/save_string.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rfl/io/save_string.hpp b/include/rfl/io/save_string.hpp index 8b19198d..17ee1433 100644 --- a/include/rfl/io/save_string.hpp +++ b/include/rfl/io/save_string.hpp @@ -14,10 +14,10 @@ Result save_string(const std::string& _fname, const T& _obj, const WriteFunction& _write) { try { std::ofstream outfile; + outfile.open(_fname); if (!outfile.is_open()) { return error("Unable to open file '" + _fname + "' for writing."); } - outfile.open(_fname); _write(_obj, outfile); outfile.close(); } catch (std::exception& e) {