- 当输入流与输出流绑在一起时,任何读输入流的尝试都将首先刷新其输出流关联的缓冲区
- 如果在调用tie函数时传递实参0,则打破该流上已存在的捆绑
#include "stdafx.h"
#include
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cin.tie(&cout);//illusstration only:the library ties cin and cout for us
ostream *old_tie=cin.tie();
cin.tie(0);//break tie to cout,cout no longer flushed when cin is read
cin.tie(&cerr);//ties cin and cerr,not necessarily a good idea!
cin.tie(0);//break tie between cin and cerr
cin.tie(&cout);//restablish normal tie between cin and cout
system("pause");
return 0;
}