Functions.Ansi2Oem Method (Byte, Long)
Convert an array of bytes from ANSI to OEM.
XSharp.Core (in XSharp.Core.dll) Version: 2.16
Syntax Request Example
bSource AS BYTE,
iLen AS LONG
) AS BYTE
public static byte Ansi2Oem(
- Type: Byte
String in Ansi format
- Type: Long
Length of the source array
A converted string of OEM characters.
Ansi2Oem() changes the individual characters in the source string to matching characters from the OEM character set.
This may need to be done because certain symbols, such as ä, have different code values in the ANSI and OEM character sets. DOS applications creating a file with ä as part of the file name use the OEM code values and place 132 into the directory entry. But Windows applications with ANSI code values use 228 for ä and thus cannot find the file.
To get around this problem, you can use Ansi2Oem() to convert ANSI file names to the OEM character set.
Also, if characters written to files by Windows applications are in the ANSI character set, the same character conversion problem might arise when DOS applications read the file.
This example writes the string "aá.TXT" to a DOS file. Note that á has the code value 225 in the ANSI character set, while in the OEM character set, code value 225 corresponds to the ß character.
The FWrite() functions assume raw binary data and thus does not automatically convert ANSI to OEM. (If desired, you could do the conversion yourself or use other functions such as FWriteText().)