This documentation is archived and is not being maintained.
ctype::widen
Visual Studio 2010
Converts a character of type char in the native character set to the corresponding character of type CharType used by a locale.
CharType widen(
char byte
) const;
const char *widen(
const char* first,
const char* last,
CharType* dest
) const;
// ctype_widen.cpp
// compile with: /EHsc /W3
#include <locale>
#include <iostream>
using namespace std;
int main( )
{
locale loc1 ( "English" );
char *str1 = "Hello everyone!";
wchar_t str2 [16];
bool result1 = (use_facet<ctype<wchar_t> > ( loc1 ).widen
( str1, str1 + strlen(str1), &str2[0] ) != 0); // C4996
str2[strlen(str1)] = '\0';
cout << str1 << endl;
wcout << &str2[0] << endl;
ctype<wchar_t>::char_type charT;
charT = use_facet<ctype<char> > ( loc1 ).widen( 'a' );
}
Hello everyone! Hello everyone!
Show: