inital commit
This commit is contained in:
commit
438c9d726c
19 changed files with 2169 additions and 0 deletions
16
readfile.h
Normal file
16
readfile.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
|
||||
inline std::string readFile(const std::filesystem::path& path)
|
||||
{
|
||||
std::ifstream file(path);
|
||||
if(!file.is_open())
|
||||
throw std::runtime_error(std::string("could not open file ") + path.string());
|
||||
std::stringstream ss;
|
||||
ss<<file.rdbuf();
|
||||
return ss.str();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue