Condividi tramite


Funzione OemToCharA (winuser.h)

Converte una stringa dal set di caratteri definito dall'OEM in una stringa ANSI o a caratteri wide.

Warning Do not use. Vedere Considerazioni sulla sicurezza.
 

Syntax

BOOL OemToCharA(
  [in]  LPCSTR pSrc,
  [out] LPSTR  pDst
);

Parameters

[in] pSrc

Type: LPCSTR

Stringa di caratteri con terminazione Null dal set di caratteri definito dall'OEM.

[out] pDst

Type: LPTSTR

Buffer di destinazione, che riceve la stringa tradotta. 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.

Remarks

Security Considerations

L'uso di questa funzione potrebbe compromettere erroneamente la sicurezza del programma. For example, miscalculating the proper size of the lpszDst buffer, especially when the application is used in both ANSI and Unicode versions, can cause a buffer overflow. Per altre informazioni, vedere Considerazioni sulla sicurezza: Funzionalità internazionali e Considerazioni sulla sicurezza: Interfaccia utente di Windows.

Note

L'intestazione winuser.h definisce OemToChar come alias che seleziona automaticamente la versione ANSI o Unicode di questa funzione in base alla definizione della costante del preprocessore UNICODE. La combinazione dell'utilizzo dell'alias indipendente dalla codifica con il codice non indipendente dalla codifica può causare mancate corrispondenze che generano errori di compilazione o di runtime. Per altre informazioni, vedere convenzioni di per i prototipi di funzioni.

Requirements

Requirement Value
client minimo supportato Windows 2000 Professional [solo app desktop]
server minimo supportato Windows 2000 Server [solo app desktop]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-chartranslation-l1-1-0 (introdotto in Windows 8)

See also

CharToOem

CharToOemBuff

Conceptual

OemToCharBuff

Reference

Strings