#include "stdafx.h"
#include "stdlib.h"
#include <list>
#include <iostream>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream readFile;
ofstream writeFile;
readFile.open("1.txt", ios::in); //保证这个文件存在
writeFile.open("2.txt", ios::out);
while (!readFile.eof())
{
char contents[128];
readFile.getline(contents, 128);
writeFile<<contents<<endl;
}
readFile.close();
writeFile.close();
return 0;
}
#include "stdlib.h"
#include <list>
#include <iostream>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
ifstream readFile;
ofstream writeFile;
readFile.open("1.txt", ios::in); //保证这个文件存在
writeFile.open("2.txt", ios::out);
while (!readFile.eof())
{
char contents[128];
readFile.getline(contents, 128);
writeFile<<contents<<endl;
}
readFile.close();
writeFile.close();
return 0;
}