输出结果:// 输出结果不容易理解,以后得学会调试输出
the content of the first file :
thefirstfileopensuccessfully.
the content of the second file :
infile.eof() is true. 说明infile文件流对象在读完first file后必须用clear清空状态
,否则infile.eof()状态一直是true
不去检查eof()而直接输出,the fisrt string of the second file is:
the content of the second file : thesecondfileopensuccessfully!
Press any key to continue
应该如此输出:;
Mode Meaning
ios::app append output
ios::ate seek to EOF when opened
ios::binary open the file in binary mode
ios::in open the file for reading
ios::out open the file for writing
ios::trunc overwrite the existing file