Export (0) Print
Expand All

OemToChar function

Translates a string from the OEM-defined character set into either an ANSI or a wide-character string.

Warning  Do not use. See Security Considerations.

Syntax


BOOL WINAPI OemToChar(
  _In_   LPCSTR lpszSrc,
  _Out_  LPTSTR lpszDst
);

Parameters

lpszSrc [in]

Type: LPCSTR

A null-terminated string of characters from the OEM-defined character set.

lpszDst [out]

Type: LPTSTR

The destination buffer, which receives the translated string. If the OemToChar 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 OemToChar is being used as a wide-character function.

Return value

Type: BOOL

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.

Security Considerations

Using this function incorrectly can compromise the security of your application.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

OemToCharW (Unicode) and OemToCharA (ANSI)

See also

Reference
CharToOem
CharToOemBuff
OemToCharBuff
Conceptual
Strings

 

 

Community Additions

ADD
Show:
© 2014 Microsoft