Initial commit
This commit is contained in:
20
src/utils.cpp
Normal file
20
src/utils.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
namespace Fan
|
||||
{
|
||||
|
||||
Opt<std::string> read_entire_file(const std::string& file_path)
|
||||
{
|
||||
std::ifstream file(file_path);
|
||||
if (!file) { return std::nullopt; }
|
||||
|
||||
std::ostringstream buffer;
|
||||
buffer << file.rdbuf();
|
||||
|
||||
return buffer.str();
|
||||
}
|
||||
|
||||
} // namespace Fan
|
||||
Reference in New Issue
Block a user