Skip to content

Commit

Permalink
utils ref
Browse files Browse the repository at this point in the history
  • Loading branch information
Prtm2110 committed Jan 10, 2025
1 parent d1204f4 commit 232b100
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Spraky-core/x64/src/utils/fileutils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "fileutils.h"
#include <fstream>
#include <sstream>
#include <stdexcept>

namespace sparky {
namespace utils {
std::string read_file(const std::string& filepath) {
std::ifstream file(filepath);
if (!file.is_open()) {
throw std::runtime_error("Failed to open file: " + filepath);
}

std::stringstream buffer;
buffer << file.rdbuf();
return buffer.str();
}
}
}

0 comments on commit 232b100

Please sign in to comment.