对于C++的I/O流和各自的缓冲区的理解
#include
#include
using namespace std;
int main()
{
ostream hexout(cout.rdbuf());
hexout.setf(ios::hex, ios::basefield);
hexout.setf(ios::showbase);
hexout << "hexout: " << 177 << " ";
//cout << "cout: " <<177 << " ";
//hexout << endl;
cout << endl;
istream hexin(cin.rdbuf());
hexin.setf(ios::hex, ios::basefield);
hexin.setf(ios::showbase);
int x;
hexin >>x;
cout << x <
hexout: 0xb1
F
15