次の方法で共有


time_get::get_weekday

曜日の名前として文字列を解析します。

iter_type get_weekday(
   iter_type _First, 
   iter_type _Last,
   ios_base& _Iosbase, 
   ios_base::iostate& _State, 
   tm* _Pt
) const;

パラメーター

  • _First
    変換するシーケンスの開始位置を示す入力反復子。

  • _Last
    変換するシーケンスの末尾を示す入力反復子。

  • _Iosbase
    通貨記号は省略可能であることを示す場合は書式指定フラグ; それ以外の場合は必須です。

  • _State
    操作が成功したかどうかに応じてストリームの状態に適したビットマスクの要素を設定します。

  • _Pt
    曜日の情報の場所に格納されるかポインター。

戻り値

入力フィールドを超える最初の要素を示す入力反復子。

解説

このメンバー関数は do_get_weekday (_First、_Last、_Iosbase、_State、_Pt) を返します。

使用例

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

   pszGetF << "mercredi";
   pszGetF.imbue(loc);
   basic_istream<char>::_Iter i = use_facet 
      <time_get<char> >
      (loc).get_weekday(basic_istream<char>::_Iter(pszGetF.rdbuf( )),   
               basic_istream<char>::_Iter(0), pszGetF, st, &t);

   if (st & ios_base::failbit)
      cout << "time_get::get_time("<< pszGetF.rdbuf( )->str( )<< ") FAILED on char: " << *i << endl;
   else

      cout << "time_get::get_time("<< pszGetF.rdbuf( )->str( )<< ") ="
      << "\ntm_wday: " << t.tm_wday
      << endl;
}
  

必要条件

ヘッダー: <locale>

名前空間: std

参照

関連項目

time_get Class