次の方法で共有


ostreambuf_iterator::failed

出力ストリーム バッファーに挿入の失敗のテスト。

bool failed( ) const throw( );

戻り値

出力ストリーム バッファーへの挿入先に失敗しなかった場合true ; それ false

解説

このメンバー関数は、メンバー operator=の前の操作では、subfの_-sputc への呼び出しが eofを返す>true を返します。

使用例

// ostreambuf_iterator_failed.cpp
// compile with: /EHsc
#include <iterator>
#include <vector>
#include <iostream>

int main( )
{
   using namespace std;

   // ostreambuf_iterator for stream cout
   ostreambuf_iterator<char> charOut ( cout );
   
   *charOut = 'a';
   charOut ++;
   *charOut  = 'b';
   charOut ++;   
   *charOut = 'c';
   cout << " are characters output individually." << endl;

   bool b1 = charOut.failed ( );
   if (b1) 
       cout << "At least one insertion failed." << endl;
   else
       cout << "No insertions failed." << endl;
}
  

必要条件

ヘッダー: の <反復子>

名前空間: std

参照

関連項目

ostreambuf_iterator クラス

標準テンプレート ライブラリ