nounitbuf
描述 (Description)
它用于清除str流的unitbuf“format”标志。 如果未设置unitbuf标志,则不会在每次插入操作后强制刷新关联的缓冲区。
声明 (Declaration)
以下是std :: nounitbuf函数的声明。
ios_base& nounitbuf (ios_base& str);
参数 (Parameters)
str - 格式标志受影响的Stream对象。
返回值 (Return Value)
它返回Argument str。
异常 (Exceptions)
Basic guarantee - 如果抛出异常,str处于有效状态。
数据竞争 (Data races)
它修改了str。 对同一流对象的并发访问可能会导致数据争用。
例子 (Example)
在下面的例子中解释了std :: nounitbuf函数。
#include <ios>
#include <fstream>
int main () {
std::ofstream outfile ("test.txt");
outfile << std::unitbuf << "Test " << "file" << '\n';
outfile.close();
return 0;
}