Created
February 1, 2019 13:33
-
-
Save looopTools/64edd6f0be3067971e0595e1e4328cbc to your computer and use it in GitHub Desktop.
How to read a file from disk to std::vector<uint8_t> in C++
This file contains hidden or 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
inline std::vector<uint8_t> read_vector_from_disk(std::string file_path) | |
{ | |
std::ifstream instream(file_path, std::ios::in | std::ios::binary); | |
std::vector<uint8_t> data((std::istreambuf_iterator<char>(instream)), std::istreambuf_iterator<char>()); | |
return data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment