Click or drag to resize

Oem2AnsiBuff Function

Convert a specified number of OEM characters in a source buffer to a buffer of corresponding, if any, ANSI characters.

Namespace:  XSharp.Core
Assembly:  XSharp.Core (in XSharp.Core.dll) Version: 2.19
 FUNCTION Oem2AnsiBuff(
	pszTarget AS BYTE[],
	pszSource AS BYTE[],
	dwCount AS DWORD
Request Example View Source


Type: Byte
A pointer to the buffer that will contain the converted string.
Type: Byte
A pointer to the buffer that contains the string to convert.
Type: DWord
The number of characters to convert.

Return Value

Type: Byte
A pointer to the buffer that contains the converted string.
Oem2AnsiBuff() is the same as Oem2Ansi, except that the resulting pointer is stored in the buffer pointed to by pszTarget.
Also, the dwCount argument lets you specify the number of characters to be converted.
Tip Tip
You are responsible for allocating space for the buffer pointed to by pszTarget.
Using an unallocated buffer pointer can have adverse results.
Caution note Caution
The Ansi2Oem() and Oem2Ansi() family of functions are compatibility functions. Do not use them unless you really have to. X# is a Unicode language and conversions from Unicode - Ansi - Oem - Unicode will take place if you use these functions.
You should also realize that Ansi2Oem(Oem2Ansi(cSource)) will not always return cSource. Some characters may not be available in the OEM codepage and could be translated to other characters. For example: Windows codepage 1252 has Capital E Umlaut (Ë) on position 203. When translated to OEM codepage 437 this will become capital E without umlaut (69). Converting back to Ansi this will remain a E without umlaut.
This example does a conversion from OEM to ANSI. Note that the source string is also used as the target string:
1LOCAL cStr := "ßá"
2Oem2AnsiBuff(Ptr(_CAST, cStr),;
3            Ptr(_CAST, cStr), sLen(cStr))
See Also