/
d.vision
/
division_engine_cpp
Обзор
Документация
Войти
/
d.vision
/
division_engine_cpp
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
include/division_engine/utility/file.hpp
27 строк
505 B
den163
Improved resources file copying. Updated core version
14 май 2024, 10:47
14 май 2024, 10:47
786818a
Код
Авторство
О чём код?
#pragma once #include <filesystem> #include <fstream> #include <sstream> #include <string> #include <division_engine/core/exception.hpp> namespace division_engine::utility::file { template<typename PathType> std::string read_text(PathType& path) { std::ifstream file { path }; if (!file.is_open()) { throw core::Exception { "Failed to open a file at path " + std::string { path } }; } std::ostringstream output {}; output << file.rdbuf(); return output.str(); } }