共用方式為


time_put::put

輸出日期和時間資訊做為 CharType的 . 序列。

iter_type put( 
   iter_type _Next,  
   ios_base& _Iosbase, 
   char_type _Fill,  
   const tm* _Pt,  
   char _Fmt,  
   char _Mod = 0 
) const; 
iter_type put( 
   iter_type _Next,  
   ios_base& _Iosbase, 
   char_type _Fill,  
   const tm* _Pt, 
   const CharType* _First,  
   const CharType* _Last 
) const;

參數

傳回值

對第一個位置的 Iterator 在插入的最後一個項目之後。

備註

第 10% 成員函式會傳回 do_put(_Next、 _Iosbase、 _Fill、 _Pt、 _Fmt, _Mod)。 第二 + 成成員函式複製到*_Next 圖表間隔 [_First, _Last) 的任何項目刪除一個百分比 (%) 之外。 對於在間隔 [_First, _Last) 的字元) 的百分比, C 函式評估 _Next = 透過 C# 的do_put(_Next、 _Iosbase、 _Fill、 _Pt, C#, 0) 並繼續。 不過,如果 C# 是從這個集合 EOQ# 的限定詞字元,後面接著在間隔 [_First, _Last) 的 C2 字元,函式評估 _Next = do_put(_Next、 _Iosbase、 _Fill、 _Pt、 C2、 *C)*和跳到 C2。

範例

// time_put_put.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
#include <time.h>
using namespace std;
int main( )
{
   locale loc;
   basic_stringstream<char> pszPutI;
   ios_base::iostate st = 0;
   struct tm t;
   memset( &t, 0, sizeof( struct tm ) );

   t.tm_hour = 5;
   t.tm_min = 30;
   t.tm_sec = 40;
   t.tm_year = 00;
   t.tm_mday = 4;
   t.tm_mon = 6;

   pszPutI.imbue( loc );
   char *pattern = "x: %X %x";
   use_facet <time_put <char> >
   (loc).put(basic_ostream<char>::_Iter(pszPutI.rdbuf( )),
          pszPutI, ' ', &t, pattern, pattern+strlen(pattern));

      cout << "num_put( ) = " << pszPutI.rdbuf( )->str( ) << endl;

      char strftimebuf[255];
      strftime(&strftimebuf[0], 255, pattern, &t);
      cout << "strftime( ) = " << &strftimebuf[0] << endl;
}
  

需求

標題: <地區設定>

命名空間: std

請參閱

參考

time_put 類別