共用方式為


CStringT::AnsiToOem

將這個 CStringT 物件的所有字元從 ANSI 字元集至 OEM 字元集。

void AnsiToOem();

備註

如果 _UNICODE 定義函式,就無法使用。

範例

// OEM character 252 on most IBM-compatible computers in
// Western countries/regions is superscript n, as in 2^n.
// Converting it to the ANSI English charset results in a
// normal character 'n', which is the closest possible
// representation.

CStringT<char, StrTraitATL<char, ChTraitsCRT<char>>> str((WCHAR)252);
str.OemToAnsi();
ASSERT(str[0] == 'n');

// Be aware that in OEM to ANSI conversion the 'n'
// from the previous result cannot be converted back to
// a supsercript n because the system does not know what
// the character's value truly was.
str.AnsiToOem();
ASSERT(str[0] != 252);
ASSERT(str[0] == 'n');   

需求

Header: cstringt.h

請參閱

參考

CStringT 類別