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

