CharToOemBuff function

Translates a specified number of characters in a string into the OEM-defined character set.

Syntax


BOOL WINAPI CharToOemBuff(
  _In_   LPCTSTR lpszSrc,
  _Out_  LPSTR lpszDst,
  _In_   DWORD cchDstLength
);

Parameters

lpszSrc [in]

Type: LPCTSTR

The null-terminated string to be translated.

lpszDst [out]

Type: LPSTR

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]

Type: DWORD

The number of characters to translate in the string identified by the lpszSrc parameter.

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.

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.

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

CharToOemBuffW (Unicode) and CharToOemBuffA (ANSI)

See also

Reference
CharToOem
OemToChar
OemToCharBuff
Conceptual
Strings

 

 

Community Additions

ADD
Show:
© 2014 Microsoft