Share via


wstring_convert::to_bytes

Converts a wide string to a byte string.

byte_string to_bytes(_Elem _Char);
byte_string to_bytes(const _Elem* _Wptr);
byte_string to_bytes(const wide_string& _Wstr);
byte_string to_bytes(const _Elem* _First, const _Elem* _Last);

Parameters

Parameter

Description

_Char

The wide character to be converted.

_Wptr

The C-style, null-terminated sequence, beginning at wptr, to be converted.

_Wstr

The wide_string to be converted.

_First

The first element in a range of elements to be converted.

_Last

The last element in a range of elements to be converted.

Remarks

If the conversion state object was not constructed with an explicit value, it is set to its default value (the initial conversion state) before the conversion begins. Otherwise it is left unchanged.

The number of input elements successfully converted is stored in the conversion count object. If no conversion error occurs, the member function returns the converted byte string. Otherwise, if the object was constructed with an initializer for the byte-string error message, the member function returns the byte-string error message object. Otherwise, the member function throws an object of class range_error.

Requirements

Header: <cvt/wstring>

Namespace: stdext::cvt

See Also

Reference

wstring_convert Class