#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream readFile;
ofstream writeFile;
char ch;
readFile.open("a.txt", ios::in);
writeFile.open("b.txt", ios::out);
while (readFile.get(ch))
writeFile.put(ch);
readFile.close();
writeFile.close();
cout << "Finish!" << endl;
return 0;
}
运行结果:
Finish!
作用:读取ch中的字符,并将其传入输出流输出