The CharToOem function translates a string into the OEM-defined character set.
Syntax
BOOL CharToOem(
LPCTSTR lpszSrc,
LPSTR lpszDst
);
Parameters
- lpszSrc
-
[in] Pointer to the null-terminated string to translate.
- lpszDst
-
[out] Pointer to the buffer for the translated string. If the CharToOem 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 CharToOem is being used as a wide-character function.
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
Windows 95/98/Me: CharToOemW 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