A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../../cpp/error/../locale/wstring_convert/to_bytes.html below:

std::wstring_convert<Codecvt,Elem,Wide_alloc,Byte_alloc>::to_bytes - cppreference.com

byte_string to_bytes( Elem wchar );

(1)

byte_string to_bytes( const Elem* wptr );

(2)

byte_string to_bytes( const wide_string& wstr );

(3)

byte_string to_bytes( const Elem* first, const Elem* last );

(4)

Converts a wide sequence to a byte string using the facet pointed to by cvtptr .

1) The wide sequence only consists of one element byte.

2) The wide sequence is the null-terminated sequence beginning at ptr.

3) The wide sequence is the sequence contained in str.

4) The wide sequence is the range [firstlast).

Before the conversion begins, if *this was not constructed with constructor overload (3), cvtstate will be set to its default value (the initial conversion state).

The number of input elements successfully converted will be stored in cvtcount .

[edit] Return value

If the conversion succeeds, returns the conversion result. Otherwise, if *this is constructed with constructor overload (4), returns byte_err_string.

[edit] Exceptions

If the conversion fails and *this was not constructed with constructor overload (4), throws std::range_error.

[edit] Example

Output:

UTF-8 conversion produced 10 bytes:
7a c3 9f e6 b0 b4 f0 9f 8d 8c 
UTF-16le conversion produced 10 bytes:
7a 00 df 00 34 6c 3c d8 4c df
[edit] See also converts a byte string into a wide string
(public member function) [edit] converts a wide string to narrow multibyte character string, given state
(function) [edit] converts a string from InternT to ExternT, such as when writing to file
(virtual protected member function of std::codecvt<InternT,ExternT,StateT>) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4