The CharToOemBuff function translates a specified number of characters in a string into the OEM-defined character set.
Syntax
BOOL CharToOemBuff(
LPCTSTR lpszSrc,
LPSTR lpszDst,
DWORD cchDstLength
);
Parameters
- lpszSrc
-
[in] Pointer to the null-terminated string to translate.
- lpszDst
-
[out] Pointer to the buffer for the translated string. If the CharToOemBuff function is being used as an ANSI function, the string can be translated in place by setting the lpszDst parameter to the same address as the lpszSrc parameter. This cannot be done if CharToOemBuff is being used as a wide-character function.
- cchDstLength
-
[in] Specifies the number of TCHARs to translate in the string identified by the lpszSrc parameter. This refers to bytes for ANSI versions of the function or WCHARs for Unicode versions.
Return Value
The return value is always nonzero except when you pass the same address to lpszSrc and lpszDst in the wide-character version of the function. In this case the function returns zero and GetLastError returns ERROR_INVALID_ADDRESS.
Remarks
Unlike the CharToOem function, the CharToOemBuff function does not stop converting characters when it encounters a null character in the buffer pointed to by lpszSrc. The CharToOemBuff function converts all cchDstLength characters.
Windows 95/98/Me: CharToOemBuffW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.
Function Information
| Minimum DLL Version | user32.dll |
|---|
| Header | Declared in Winuser.h, include Windows.h |
|---|
| Import library | User32.lib |
|---|
| Minimum operating systems |
Windows 95, Windows NT 3.1 |
|---|
| Unicode | Implemented as
ANSI and Unicode versions. |
|---|
See Also
Strings Overview, CharToOem, OemToChar, OemToCharBuff