共用方式為


basic_ios::widen

Finds the equivalent char_type to a given char.

char_type widen(
    char _Char
) const;

Parameters

  • _Char
    The character to convert.

Return Value

Finds the equivalent char_type to a given char.

Remarks

The member function returns use_facet< ctype<E> >( getloc). widen(_Char).

Example

// basic_ios_widen.cpp
// compile with: /EHsc
#include <ios>
#include <iostream>
#include <wchar.h>

int main( ) 
{
   using namespace std;
   char *z = "Hello";
   wchar_t y[2] = {0,0};
   cout << z[0] << endl;
   y[0] = wcout.widen( z[0] );
   wcout << &y[0] << endl;
}

Output

H
H

Requirements

Header: <ios>

Namespace: std

See Also

Reference

basic_ios Class

iostream Programming

iostreams Conventions