Platform Package reference: Function EwStringToAnsi()

Description of the function EwStringToAnsi() available in all Platform Packages for C compatible target systems. This function is intended to be used when integrating the Embedded Wizard created GUI application with the underlying graphics subsystem, graphics hardware or other external GUI applications coexisting on the same system.

Declaration

XInt32 EwStringToAnsi( XString aString, char* aDest, XInt32 aCount, char aDefChar )

Parameters

aString

Pointer to a zero terminated wide-character (16-bit per character) string to convert in a zero terminated ANSI (8-bit per character) string.

aDest

Pointer to the destination memory, where the resulting 8-bit ANSI string should be stored in. This memory area has to be at least aCount bytes large.

aCount

The number of characters to convert including the zero terminator sign.

aDefChar

The code of an ANSI 8-bit character to be used for all source characters with codes > 255.

Discussion

The function EwStringToAnsi() converts up to aCount characters from the given 16-bit wide-character string aString in an 8-bit ANSI string and stores it in the memory area aDest. The resulting string is zero terminated.

Character codes greater than 255 are replaced by the value passed in the parameter aDefChar. This is necessary, since the character codes in the 16-bit coded source string can lie in range up to 65535. The destination string, in turn, is limited to codes up to the value 255. The function returns the number of converted characters incl. the last zero terminator sign.