MKI_ConvertInt32ToUTF16 (Strings) New in Version 2019.1

www.CAD6.com

C++ Syntax

__int32

MKI_ConvertInt32ToUTF16(

 __int32 f_nSource,

 LPWSTR f_pszDestin,

 const size_t f_unMaxSize );

 

 template <size_t f_unSize> __int32

 MKI_ConvertInt32ToUTF16(

         __int32 f_nSource,

         wchar_t (&f_rDestin)[f_unSize] )

 

Converts a single Unicode character value to a UTF-16 Unicode text.

 

Please note that using Unicode characters in the range above 0x0000ffff can result in unexpected behavior since texts are always parsed one character at a time.

 

Parameters

Source

[__int32] Unicode character value. Valid range is 0x00000000 to 0x0010ffff. Values of 0x0000d800 to 0x0000dfff (surrogates) may be used although those are undefined Unicode characters, they will result in a non-standard-conform UTF-16 text that most systems can handle (including MKI_ConvertUTF16ToInt32).

Destin

[LPWSTR] Pointer to or [wchar_t[]&] Reference to a UTF-16 string that shall receive the converted text with a fixed maximum length.

MaxSize

[const size_t] Maximum allowed length of the destination text in UTF-16 characters including the terminating '\0' character.

 

Return Value

Returns the length of the resulting string in characters (excluding the terminating '\0' character, either 1 or 2. In case of an error, 0 is returned.

 

Comment

If 1 or 2 is returned, the resulting text will always be terminated with a '\0' character.

 

CAD6interface 2025.0 - Copyright 2025 Malz++Kassner® GmbH