描述
它用於清除 str 流的 unitbuf "format" 標誌。如果未設置 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;
}
相關用法
- C++ ios nouppercase用法及代碼示例
- C++ ios noshowbase用法及代碼示例
- C++ ios noshowpoint用法及代碼示例
- C++ ios noskipws用法及代碼示例
- C++ ios noshowpos用法及代碼示例
- C++ ios noboolalpha用法及代碼示例
- C++ ios eof()用法及代碼示例
- C++ ios manipulators boolalpha()用法及代碼示例
- C++ ios Scientific用法及代碼示例
- C++ ios manipulators left()用法及代碼示例
- C++ ios fixed用法及代碼示例
- C++ ios manipulators dec()用法及代碼示例
- C++ ios manipulators uppercase()用法及代碼示例
- C++ ios manipulators hex()用法及代碼示例
- C++ ios manipulators unitbuf()用法及代碼示例
- C++ ios showpos用法及代碼示例
- C++ ios manipulators nouppercase()用法及代碼示例
- C++ ios manipulators skipws()用法及代碼示例
- C++ ios dec用法及代碼示例
- C++ ios Internal用法及代碼示例
注:本文由純淨天空篩選整理自 C++ ios Library - Nountibuf Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。