Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如:
void Display() { cout << "Hello World" << endl; } stringstream ss;
如何将display方法输入到ss字符串流中?
display
ss
// Save the old cout's streambuf streambuf* old = cout.rdbuf(); ostringstream oss; // replace cout's streambuf with the ostringstream's cout.rdbuf(oss.rdbuf()); // Call Display Display(); // Restore the old cout cout.rdbuf(old);
评论本身的解释。