VIPRA Documentation
Loading...
Searching...
No Matches
file_operations.hpp
1#pragma once
2
3#include <fstream>
4#include <ios>
5#include <stdexcept>
6#include <string>
7
8namespace VIPRA::Util {
9inline void append_to_file(std::string const& filepath, std::string_view output)
10{
11 std::ofstream file(filepath, std::ios_base::app);
12
13 if ( ! file.is_open() ) throw std::runtime_error("Unable to open file: " + filepath);
14
15 file << output;
16}
17} // namespace VIPRA::Util