basic_ios::narrow
Finds the equivalent char to a given char_type.
char narrow(
char_type _Char,
char _Default = '\0'
) const;
매개 변수
_Char
변환할 char입니다._Default
The char that you want returned if no equivalent is found.
반환 값
The equivalent char to a given char_type.
설명
The member function returns 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
요구 사항
Header: <ios>
네임스페이스: std