Skip to content

Instantly share code, notes, and snippets.

@nathanjackson
Created April 27, 2022 05:18
Show Gist options
  • Save nathanjackson/f4116ed0313a481b7d5edfb621e99fc4 to your computer and use it in GitHub Desktop.
Save nathanjackson/f4116ed0313a481b7d5edfb621e99fc4 to your computer and use it in GitHub Desktop.
read file using istreambuf
#include <fstream>
#include <iterator>
#include <vector>
int main(int argc, char** argv)
{
std::ifstream ifs(argv[1], std::ios::binary);
std::istreambuf_iterator<char> begin(ifs), end;
std::vector<uint8_t> data(begin, end);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment