#ifndef RFL_IO_SAVE_BYTES_HPP_ #define RFL_IO_SAVE_BYTES_HPP_ #include #include #include #include #include "rfl/Result.hpp" namespace rfl { namespace io { Result save_bytes(const std::string& _fname, const std::vector& _bytes) { try { std::ofstream output(_fname, std::ios::out | std::ios::binary); output.write(reinterpret_cast(_bytes.data()), _bytes.size()); output.close(); } catch (std::exception& e) { return Error(e.what()); } return Nothing{}; } } // namespace io } // namespace rfl #endif