Advertisement
Gistrec

Read file to vector/string

Oct 19th, 2018
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <vector>
  2. #include <fstream>
  3. #include <cassert>
  4. #include <iterator>
  5.  
  6. vector<char> file;
  7.  
  8. std::ifstream input(fileName);
  9. assert(input.good());
  10.  
  11. std::istream_iterator<char> start(input), end;
  12. file.insert(file.begin(), start, end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement