65,191
社区成员




#include <windows.h>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<string> tmp_files;
ifstream winfile( "a.txt" );
if ( ! winfile )
{
cout << "fail" << endl;
return 0;
}
string lineContent;
while ( getline( winfile, lineContent, '\n' ) )
{
tmp_files.push_back( lineContent + "\r\n" );
}
winfile.close();
ofstream offile( "a.txt",ios::out );
vector<string>::iterator siter = tmp_files.begin();
copy( tmp_files.begin(), tmp_files.end()-1, ostream_iterator<string>(offile) );
cout << "ok!" << endl;
offile.close();
return 0;
}