std::wstring_convert<Codecvt,Elem,Wide_alloc,Byte_alloc>::from_bytes (3) - Linux Manuals
std::wstring_convert<Codecvt,Elem,Wide_alloc,Byte_alloc>::from_bytes: std::wstring_convert<Codecvt,Elem,Wide_alloc,Byte_alloc>::from_bytes
NAME
std::wstring_convert<Codecvt,Elem,Wide_alloc,Byte_alloc>::from_bytes - std::wstring_convert<Codecvt,Elem,Wide_alloc,Byte_alloc>::from_bytes
Synopsis
Defined in header <locale>
wide_string from_bytes( char byte ); (1)
wide_string from_bytes( const char* ptr ); (2)
wide_string from_bytes( const byte_string& str ); (3)
wide_string from_bytes( const char* first, const char* last); (4)
Performs multibyte to wide conversion, using the codecvt facet supplied at construction.
1) Converts byte as if it was a string of length 1 to wide_string
2) Converts the null-terminated multibyte character sequence beginning at the character pointed to by ptr to wide_string
3) Converts the narrow string str to wide_string.
4) Converts the narrow multibyte character sequence [first, last) to wide_string
In all cases, the conversion begins in initial shift state, unless non-initial starting state was provided to this wstring_convert constructor. The number of characters converted and the final value of the conversion state are remembered and can be accessed with state() and converted()
Return value
A wide_string object containing the results of multibyte to wide conversion. If the conversion failed and there was a user-supplied wide-error string provided to the constructor of this wstring_convert, returns that wide-error string.
Exceptions
If this wstring_convert object was constructed without a user-supplied wide-error string, throws std::range_error on conversion failure.
Example
// Run this code
Output:
See also
to_bytes (public member function)
mbsrtowcs (function)
do_in converts a string from externT to internT, such as when reading from file
[virtual]