Last active
April 14, 2021 02:12
-
-
Save vxcute/a1a2b71a39534c3ef80a289f28aed89d 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
// simple way to read a Binary File using modern c++ | |
#include <iostream> | |
#include <vector> | |
#include <fstream> | |
#include <iterator> | |
template <typename T> | |
auto ReadBinFile(std::string FilePath) -> std::vector<T> | |
{ | |
std::ifstream File(FilePath, std::ios::binary); | |
std::vector<unsigned char> FileBuf(std::istreambuf_iterator<char>(File), {}); | |
return FileBuf; | |
} | |
int main() | |
{ | |
std::vector<uint8_t> FileBuf = ReadBinFile<uint8_t>("path"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment