money_get::get
통화 값을 나타내는 문자 시퀀스를 숫자 값을 추출 합니다.
iter_type get(
iter_type _First,
iter_type _Last,
bool _Intl,
ios_base& _Iosbase,
ios_base::iostate& _State,
long double& _Val
) const;
iter_type get(
iter_type _First,
iter_type _Last,
bool _Intl,
ios_base& _Iosbase,
ios_base::iostate& _State,
string_type& _Val
) const;
매개 변수
_First
변환할 시퀀스의 시작 주소를 지정 하는 반복기를 입력 합니다._Last
변환할 시퀀스의 끝 주소를 지정 하는 반복기를 입력 합니다._Intl
입력 시퀀스에서 예상 되는 통화 기호를 나타내는 부울 값: true 국제 경우 거짓 국내 경우._Iosbase
형식 플래그는 설정 통화 기호입니다; 경우 그렇지 않으면 필수입니다._State
해당 비트 마스크 요소 작업에 성공 했습니다 여부에 따라 스트림의 상태를 설정 합니다._Val
변환 된 시퀀스를 저장 하는 문자열입니다.
반환 값
주소 통화 입력된 필드의 첫 번째 요소는 입력된 반복기입니다.
설명
Both member functions return do_get(_First, _Last, _Intl, _Iosbase, _State, _Val).
예제
// money_get_get.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
#include <sstream>
using namespace std;
int main( )
{
locale loc( "german_germany" );
basic_stringstream< char > psz;
psz << use_facet<moneypunct<char, 1> >(loc).curr_symbol() << "-1.000,56";
basic_stringstream< char > psz2;
psz2 << "-100056" << use_facet<moneypunct<char, 1> >(loc).curr_symbol();
ios_base::iostate st = 0;
long double fVal;
psz.flags( psz.flags( )|ios_base::showbase );
// Which forced the READING the currency symbol
psz.imbue(loc);
use_facet < money_get < char > >( loc ).
get( basic_istream<char>::_Iter( psz.rdbuf( ) ),
basic_istream<char>::_Iter( 0 ), true, psz, st, fVal );
if ( st & ios_base::failbit )
cout << "money_get(" << psz.str( ) << ", intl = 1) FAILED"
<< endl;
else
cout << "money_get(" << psz.str( ) << ", intl = 1) = "
<< fVal/100.0 << endl;
use_facet < money_get < char > >( loc ).
get(basic_istream<char>::_Iter(psz2.rdbuf( )),
basic_istream<char>::_Iter(0), false, psz2, st, fVal);
if ( st & ios_base::failbit )
cout << "money_get(" << psz2.str( ) << ", intl = 0) FAILED"
<< endl;
else
cout << "money_get(" << psz2.str( ) << ", intl = 0) = "
<< fVal/100.0 << endl;
};
샘플 출력
Windows 2000 또는 이전 버전을 실행 하는 경우이 출력을 발생 합니다.
money_get(DEM-1.000,56, intl = 1) = -1000.56
money_get(-100056DM, intl = 0) = -1000.56
Windows XP를 실행 하는 경우이 출력을 얻게 됩니다.
money_get(EUR-1.000,56, intl = 1) = -1000.56
money_get(-100056EUR, intl = 0) = -1000.56
요구 사항
헤더: <locale>
네임 스페이스: std