time_get::get_monthname
Analizza una stringa come nome del mese.
iter_type get_monthname(
iter_type _First,
iter_type _Last,
ios_base& _Iosbase,
ios_base::iostate& _State,
tm* _Pt
) const;
Parametri
_First
Iteratore di input destinato all'inizio della sequenza da convertire._Last
Iteratore di input destinato alla fine della sequenza da convertire._Iosbase
Non utilizzato._State
Un parametro di output che imposta gli elementi appropriati della maschera di bit dello stato del flusso a seconda di come le operazioni sono completate._Pt
Un puntatore in cui le informazioni del mese devono essere archiviate.
Valore restituito
Un iteratore di input destinato al primo elemento oltre il campo di input.
Note
La funzione membro restituisce do_get_monthname(_First, _Last, _Iosbase, _State, _Pt).
Esempio
// 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;
}
Requisiti
intestazione: <locale>
Spazio dei nomi: deviazione standard