次の方法で共有


CharToOemW 関数 (winuser.h)

文字列を OEM 定義の文字セットに変換します。

Warning Do not use. 「セキュリティに関する考慮事項」を参照してください。
 

Syntax

BOOL CharToOemW(
  [in]  LPCWSTR pSrc,
  [out] LPSTR   pDst
);

Parameters

[in] pSrc

Type: LPCTSTR

変換する null で終わる文字列。

[out] pDst

Type: LPSTR

変換された文字列を受け取る宛先バッファー。 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.

Remarks

Security Considerations

この関数を誤って使用すると、プログラムのセキュリティが損なわれる可能性があります。 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. 詳細については、「 セキュリティに関する考慮事項: 国際機能セキュリティに関する考慮事項: Windows ユーザー インターフェイス」を参照してください。

Note

winuser.h ヘッダーは、Unicode プリプロセッサ定数の定義に基づいて、この関数の ANSI または Unicode バージョンを自動的に選択するエイリアスとして CharToOem を定義します。 エンコードに依存しないエイリアスをエンコードに依存しないコードと組み合わせて使用すると、コンパイルエラーやランタイム エラーが発生する不一致が発生する可能性があります。 詳細については、「関数プロトタイプの 規則」を参照してください。

Requirements

Requirement Value
サポートされる最小クライアント Windows 2000 Professional [デスクトップ アプリのみ]
サポートされる最小サーバー Windows 2000 Server [デスクトップ アプリのみ]
Target Platform Windows
Header winuser.h (Windows.h を含む)
Library User32.lib
DLL User32.dll
API set ext-ms-win-ntuser-chartranslation-l1-1-0 (Windows 8 で導入)

See also

CharToOemBuff

Conceptual

OemToChar

OemToCharBuff

Reference

Strings