blob: 7e783c2fba6bd15bcc73fa20e74914ae85e45b6f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "../include.h"
#include "io.h"
bool io::read_file(const std::string_view name, std::vector<char>& out) {
std::ifstream file(name.data(), std::ios::binary);
if (!file.good()) {
log_error("{} isnt valid.", name);
return false;
}
file.unsetf(std::ios::skipws);
file.seekg(0, std::ios::end);
const size_t size = file.tellg();
file.seekg(0, std::ios::beg);
out.resize(size);
file.read(&out[0], size);
file.close();
return true;
}
|