Created
January 16, 2023 23:05
-
-
Save zhuker/2c3a646a37fb68c10fe068e9e09ac67b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static std::vector<char> readAllBytes(char const* filename) | |
{ | |
std::ifstream ifs(filename, std::ios::binary | std::ios::ate); | |
std::ifstream::pos_type pos = ifs.tellg(); | |
if (pos == 0) | |
{ | |
return std::vector<char>{}; | |
} | |
std::vector<char> result(pos); | |
ifs.seekg(0, std::ios::beg); | |
ifs.read(&result[0], pos); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment