C++ ios 庫 - nountibuf 函式



描述

它用於清除 str 流的 unitbuf “格式”標誌。當未設定 unitbuf 標誌時,不會強制在每次插入操作後重新整理關聯的緩衝區。

宣告

以下是 std::nounitbuf 函式的宣告。

ios_base& nounitbuf (ios_base& str);

引數

str − 受影響的流物件的格式標誌。

返回值

它返回引數 str。

異常

基本保證 − 如果丟擲異常,則 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;
}
ios.htm
廣告

© . All rights reserved.