#include <stdafx.h> #include "IO.h" namespace fpr { std::vector<char> ReadFile(const std::string_view filename) FPR_NOEXCEPT { //Read file, return raw bytes. std::ifstream file(filename.data(), std::ios::binary | std::ios::ate); assert(file.is_open()); size_t file_size = static_cast<size_t>(file.tellg()); std::vector<char> buffer(file_size); file.seekg(0); file.read(buffer.data(), (std::streamsize)file_size); file.close(); return buffer; } std::string GetFileExtension(const std::string& file_name) { std::string::size_type last_dot_index = file_name.rfind('.'); assert((last_dot_index != std::string::npos)); return file_name.substr(last_dot_index + 1); } } // namespace fpr