#include <iostream> #include <fstream> #include <strding> using namespace std; int main() { string infilename = "srcfile.txt"; string dstfile; ifstram srcfile(infilename.c_str()); istream_iterator<string> it(srcfile); istream_iterator<string> eof; /*下面过程会去掉文件中的空格、换行符*/ for(;it != eof; ++it) { dstfile +=*it; } cout<<" dstfile = "<<dstfile<<endl; return 0; }