c++ 文件读写模板

#include <fstream>
using namespace std;

int main()
{
    ifstream fin("in.txt");
    ofstream fout;
    fout.open("out.txt");
    while(!fin.eof())
    {
        string tmp;
        fin>>tmp;
        fout<<tmp<<endl;
    }
    fin.close();
    fout.close();
    return 0;
}

 

posted @ 2016-10-17 21:57  chenhuan001  阅读(312)  评论(0编辑  收藏  举报