Giriş
UTF16'dan Multi Byte Character Set'e çevirir. Açıklaması şöyle.
Örnek
Şöyle yaparız.
UTF16'dan Multi Byte Character Set'e çevirir. Açıklaması şöyle.
Multibyte character sets (MBCSs) are an older approach to the need to support character sets, like Japanese and Chinese, that cannot be represented in a single byte. If you are doing new development, you should use Unicode for all text strings except perhaps system strings that are not seen by end users. MBCS is a legacy technology and is not recommended for new development.
Örnek
Şöyle yaparız.
std::string UTF16_to_MBCS(LPCWSTR wsz)
{
// MBCS to UNICODE
std::string strResult;
size_t nCharsDone = 0;
const size_t nMaxWords = 2 * wcslen(wsz);
strResult.resize(nMaxWords + 1);
if (S_OK == ::wcstombs_s(&nCharsDone, &strResult[0], nMaxWords + 1, wsz, nMaxWords))
strResult.resize(nCharsDone);
else
strResult.clear();
return strResult;
}
Hiç yorum yok:
Yorum Gönder