다음을 통해 공유


basic_ios::narrow

검색에 해당 하는 char는 지정 된 char_type.

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

매개 변수

  • _Char
    변환할 char입니다.

  • _Default
    char 해당이 없으면 반환 된 원하는.

반환 값

해당 하는 char 에 지정 된 char_type.

설명

멤버 함수를 반환 합니다. use_facet<ctype<E> >( getloc( ) ).narrow(_Char, _Default).

예제

// 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

요구 사항

헤더: <ios>

네임 스페이스: std

참고 항목

참조

basic_ios Class

iostream 프로그래밍

iostreams 규칙