How do you read n bytes from a file and put them into a vector<uint8_t> using iterators?
问题 Based on this this question: How to read a binary file into a vector of unsigned chars In the answer they have: std::vector<BYTE> readFile(const char* filename) { // open the file: std::basic_ifstream<BYTE> file(filename, std::ios::binary); // read the data: return std::vector<BYTE>((std::istreambuf_iterator<BYTE>(file)), std::istreambuf_iterator<BYTE>()); } Which reads the entire file into the vector. What I want to do is read (for example) 100 bytes at a time in the vector, then do stuff,