ホーム » 2010 » 8月 » 25

日別アーカイブ: 2010/08/25

2010年8月
1234567
891011121314
15161718192021
22232425262728
293031  

カテゴリー

アーカイブ

ブログ統計情報

  • 79,940 アクセス



CString で保存される形式

BOM — U+FEFF

UNICODE  FF FE FF  04  32 00  30 00  31 00  30 00 
MBCS    04 32 30 31 30


//  VC98\MFC\SRC\ArcCore.cpp

// CString serialization code
// String format:
//  UNICODE strings are always prefixed by 0xff, 0xfffe
//  if < 0xff chars: len:BYTE, TCHAR chars
//  if >= 0xff characters: 0xff, len:WORD, TCHAR chars
//  if >= 0xfffe characters: 0xff, 0xffff, len:DWORD, TCHARs

CArchive& AFXAPI operator<<(CArchive& ar, const CString& string)
{
  // special signature to recognize unicode strings
  #ifdef _UNICODE
   ar << (BYTE)0xff;
   ar << (WORD)0xfffe;

  #endif
  if (string.GetData()->nDataLength < 255) {
   ar << (BYTE)string.GetData()->nDataLength;
   }
  else if (string.GetData()->nDataLength < 0xfffe) {
   ar << (BYTE)0xff;
   ar << (WORD)string.GetData()->nDataLength;
   }
  else {
   ar << (BYTE)0xff;
   ar << (WORD)0xffff;
   ar << (DWORD)string.GetData()->nDataLength;
   }
  ar.Write(string.m_pchData, string.GetData()->nDataLength*sizeof(TCHAR));
  return ar;
  }

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.