basic_ios::narrow

Encuentra char equivalente a char_typeespecificado.

char narrow(
    char_type _Char,
    char _Default = '\0'
) const;

Parámetros

  • _Char
    char que se va a convertir.

  • _Default
    char que desee devueltos si no se encuentra ningún equivalente.

Valor devuelto

char equivalente a char_typeespecificado.

Comentarios

La función miembro devuelve use_facet< C<E> > ( getloc()).narrow(_Char, _Default).

Ejemplo

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

int main( ) 
{
   using namespace std;
   wchar_t *x = L"test";
   char y[10];
   cout << x[0] << endl;
   wcout << x << endl;
   y[0] = wcout.narrow( x[0] );
   cout << y[0] << endl;
}

Output

116
test
t

Requisitos

encabezado: <IOS>

espacio de nombres: std

Vea también

Referencia

basic_ios Class

programación iostream

convenciones de iostreams