CharToOem function
Applies to: desktop apps only
Translates a string into the OEM-defined character set.
Warning Do not use. See Security Considerations.
Syntax
BOOL WINAPI CharToOem( __in LPCTSTR lpszSrc, __out LPSTR lpszDst );
Parameters
- lpszSrc [in]
-
Type: LPCTSTR
The null-terminated string to be translated.
- lpszDst [out]
-
Type: LPSTR
The destination buffer, which receives 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
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 |
|---|---|
|
Minimum supported server | Windows 2000 Server |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names | CharToOemW (Unicode) and CharToOemA (ANSI) |
See also
- Reference
- CharToOemBuff
- OemToChar
- OemToCharBuff
- Conceptual
- Strings
Send comments about this topic to Microsoft
Build date: 2/3/2012