【发布时间】:2011-06-13 21:09:26
【问题描述】:
给定一个将输出字符串流作为参数的函数:
void Foo(const std::ostringstream& _oss);
有没有办法将流缓冲区写入文件无需必须调用 str() ?
我想避免复制缓冲区(str() 会这样做)。
void Foo(const std::ostringstream& _oss);
{
std::ofstream f("foo.bin");
//WANT: write _oss to f without copying the buffer?
}
【问题讨论】: