分析字符串作为的月份名称。
iter_type get_monthname(
iter_type _First,
iter_type _Last,
ios_base& _Iosbase,
ios_base::iostate& _State,
tm* _Pt
) const;
参数
_First
输入解决的序列开始的迭代器是转换。_Last
输入解决序列末尾的迭代器是转换。_Iosbase
未使用。_State
设置流状态的相应位屏蔽的元素的输出参数,根据使用选择的操作成功。_Pt
指向的指针使用信息中的存储位置。
返回值
输入解决超出范围之外的输入迭代器的第一个元素。
备注
成员函数返回 do_get_monthname(_First、_Last、_Iosbase、_State,_Pt)。
示例
// time_get_get_monthname.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 << "juillet";
pszGetF.imbue( loc );
basic_istream<char>::_Iter i = use_facet <time_get <char> >
(loc).get_monthname(basic_istream<char>::_Iter(pszGetF.rdbuf( )),
basic_istream<char>::_Iter(0), pszGetF, st, &t);
if (st & ios_base::failbit)
cout << "time_get("<< pszGetF.rdbuf( )->str( )<< ") FAILED on char: " << *i << endl;
else
cout << "time_get("<< pszGetF.rdbuf( )->str( )<< ") ="
<< "\ntm_sec: " << t.tm_sec
<< "\ntm_min: " << t.tm_min
<< "\ntm_hour: " << t.tm_hour
<< "\ntm_mday: " << t.tm_mday
<< "\ntm_mon: " << t.tm_mon
<< "\ntm_year: " << t.tm_year
<< "\ntm_wday: " << t.tm_wday
<< "\ntm_yday: " << t.tm_yday
<< "\ntm_isdst: " << t.tm_isdst
<< endl;
}
要求
页眉: <区域设置>
命名空间: std