21 lines
327 B
C++
21 lines
327 B
C++
#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
|