From 132ddf65fe6e253ebd113036d61c51cd0eb5e827 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 2 Oct 2024 10:12:45 -0500 Subject: Add method to write data where size = length. --- include/fud_c_file.hpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/fud_c_file.hpp b/include/fud_c_file.hpp index f451292..0d52e95 100644 --- a/include/fud_c_file.hpp +++ b/include/fud_c_file.hpp @@ -267,6 +267,17 @@ class CFile { return self.read(&destination, sizeof(destination), length, offset); } + [[nodiscard]] WriteResult write(const void* source, size_t sourceSize) + { + auto& self = static_cast(*this); + auto offsetResult = self.size(); + if (offsetResult.isError()) { + return WriteResult{0, offsetResult.getError()}; + } + + return self.write(source, sourceSize, sourceSize, offsetResult.getOkay()); + } + [[nodiscard]] WriteResult write(const void* source, size_t sourceSize, size_t length) { auto& self = static_cast(*this); -- cgit v1.2.3