Advertisement
Guest User

Untitled

a guest
Sep 10th, 2012
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <fstream>
  2. #include <vector>
  3. #include <iterator>
  4.  
  5. int main()
  6. {
  7.     std::ifstream ifs("test.txt");
  8.     ifs.unsetf(std::ios::skipws);
  9.     std::vector<char> buf(
  10.         (std::istream_iterator<char>(ifs)),
  11.          std::istream_iterator<char>());
  12.     std::ofstream ofs("testcopy.txt", std::ios::binary);
  13.     ofs.write(buf.data(), buf.size());
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement