17 lines
438 B
C++
17 lines
438 B
C++
#include "readFile.h"
|
|
#include "catch2/catch.hpp"
|
|
#include <fstream>
|
|
|
|
std::vector<std::byte> readFile(const std::filesystem::path& fileName) {
|
|
std::ifstream file(fileName, std::ios::binary | std::ios::ate);
|
|
REQUIRE(file);
|
|
|
|
std::streamsize size = file.tellg();
|
|
file.seekg(0, std::ios::beg);
|
|
|
|
std::vector<std::byte> buffer(static_cast<size_t>(size));
|
|
file.read(reinterpret_cast<char*>(buffer.data()), size);
|
|
|
|
return buffer;
|
|
}
|