CString转换为string的做法计算机等级考试
文章作者 100test 发表时间 2010:01:26 09:54:35
来源 100Test.Com百考试题网
 
    
  CString转换为std::string,网上通行的做法是利用CString的GetBuffer函数。具体做法如下(编译环境为VS C   2005 sp1, Win XP sp3,多字节字符集编译,以下同):
  CString strMFC= _T("Hello!").
  std::string str2(strMFC.GetBuffer()).
  strMFC.ReleaseBuffer().
  这种做法在unicode字符集下也可行。今天我探索了一种新做法,具体做法是:
  CString strMFC= _T("Hello!").
  TCHAR *psz =