MKI_ConvertUTF16ToTaggedAnsi (Strings) Renamed in Version 2024.1

www.CAD6.com

C++ Syntax

bool

MKI_ConvertUTF16ToTaggedAnsi(

 const LPCWSTR f_pszSource,

 LPSTR f_pszDestin,

 const size_t f_unMaxSize );

 

template <size_t f_unSize> bool

MKI_ConvertUTF16ToTaggedAnsi(

 const LPCWSTR f_pszSource,

 char (&f_rDestin)[f_unSize] )

 

bool

MKI_ConvertUTF16ToTaggedAnsi(

 const LPCWSTR f_pszSource,

 const size_t f_unCharNum,

 LPSTR f_pszDestin,

 const size_t f_unMaxSize );

 

template <size_t f_unSize> bool

MKI_ConvertUTF16ToTaggedAnsi(

 const LPCWSTR f_pszSource,

 const size_t f_unCharNum,

 char (&f_rDestin)[f_unSize] )

 

Converts a UTF-16 Unicode text to an Ansi text with Unicode encoding.

 

Parameters

f_pszSource

[const LPCWSTR] Address of the source UTF-16 text.

f_unCharNum

[const size_t] Maximum number of characters of the source text to convert (not including any terminating '\0' character). If f_unCharNum is not stated or the source text is shorter, it will be converted completely.

f_pszDestin / f_rDestin

[LPSTR] Pointer to or [char[]&] Reference to an Ansi string that shall receive the converted text with a fixed maximum length. Unicode characters outside the Ansi codepage will be converted to HTML-style Unicode character definitions in the &#xxx; form.

f_unMaxSize

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

 

Return Value

Returns true if the conversion was successful and the resulting string fit into the buffer. If false is returned since the buffer was too small, as many characters as possible were already converted and terminated by a '\0' character.

 

Comment

The resulting text will always be terminated with a '\0' character if the buffer size is at least 1, even if false is returned! The text may, however, be truncated.

 

CAD6interface 2026.0 - Copyright 2026 Malz++Kassner® GmbH