codecvt::out

转换生成 CharType。序列对外部 Byte(. 序列。

result out(
    StateType& _State,
    const CharType* _First1, 
    const CharType* _Last1,
    const CharType*& _Next1,
    Byte* _First2, 
    Byte* _Last2, 
    Byte*& _Next2
) const;

参数

  • _State
    保持在指向成员函数调用之间的状态转换。

  • _First1
    将转换序列的开头的指针。

  • _Last1
    将的转换序列的结尾的指针。

  • _Next1
    到指针的引用。在最后 CharType 之后的第一个没有。CharType 转换。

  • _First2
    转换序列的开头的指针。

  • _Last2
    转换序列的结尾的指针。

  • _Next2
    到指针的引用。在上转换的 Byte之后的第一个没有。Byte

返回值

成员函数返回 do_out(_State、_First1、_Last1、_Next1、_First2、_Last2,_Next2)。

备注

有关详细信息,请参阅codecvt::do_out

示例

// codecvt_out.cpp
// compile with: /EHsc
#define _INTL
#include <locale>
#include <iostream>
#include <wchar.h>
using namespace std;
#define LEN 90
int main( )   
{
   char pszExt[LEN+1];
   wchar_t *pwszInt = L"This is the wchar_t string to be converted.";
   memset( &pszExt[0], 0, ( sizeof( char ) )*( LEN+1 ) );
   char* pszNext;
   const wchar_t* pwszNext;
   mbstate_t state;
   locale loc("C");//English_Britain");//German_Germany
   int res = use_facet<codecvt<wchar_t, char, mbstate_t> >
      ( loc ).out( state,
      pwszInt, &pwszInt[wcslen( pwszInt )], pwszNext ,
      pszExt, &pszExt[wcslen( pwszInt )], pszNext );
   pszExt[wcslen( pwszInt )] = 0;
   cout << ( ( res!=codecvt_base::error ) ? "It worked: " : "It didn't work: " )
   << "The converted string is:\n ["
   << &pszExt[0]
   << "]" << endl;
}
  

要求

页眉: <区域设置>

命名空间: std

请参见

参考

codecvt 类