SHARE
TWEET

Untitled

a guest Sep 10th, 2012 20 Never
  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. }
RAW Paste Data
Top