#include <fstream>
#include <iostream>
using namespace std;
void main()
{
char buf[1024*50]={0};
//读
ifstream inFile;
inFile.open("cloudComputing.txt");
//inFile.open("D:\testout.dat",ios::in);
int arr =0;
while (inFile.good())
{
inFile>>buf[arr];
arr++;
}
inFile.close();
//写
ofstream outFile;
//outFile.open("D:\testout.dat",ios::out);
outFile.open("D:\cloudComputingNew.txt",ios::app);//ios::app表示在文件末尾写
for (int i =0; i<= arr; i++)
{
outFile<<buf[i];
}
outFile.close();
}
参见:https://www.cnblogs.com/ifeiyun/articles/1573134.html