您的位置:首页 > 编程语言 > C语言/C++

Iostreams part1(Chapter 2 of Thinking in C++ Vol 2)

2010-12-12 15:54 429 查看
code 1 #include <iostream>
2 #include <fstream>
3 using namespace std;
4
5 int main()
6 {
7 ifstream in("IOfile.cpp");
8 ofstream out("IOfile.out");
9 out << in.rdbuf();
in.close();
out.close();

ifstream in2("IOfile.out", ios::in | ios::out);
ostream out2(in2.rdbuf());
cout << in2.rdbuf();
out2 << "Where does this end up?";
out2.seekp(0, ios::beg);
out2 << "And what about this?";
in2.seekg(0, ios::beg);
cout << in2.rdbuf();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: