C++タイプ変換まとめ


本編ではプログラミングで出会ったタイプ変換に基づいてゆっくりとものを加えます.
CString回転int
CString str("123");//           ,                         ,           ,  0
int i= _ttoi(str);

CString char*(UNICコード文字セット環境)
#include <afxpriv.h>//        
CString strTest = _T("abcd");//    CString
USES_CONVERSION;
char *p = T2A(strTest);

CString回転CComVariant
CComVariant cobject;
CString result=L"HAHHAH";
cobject = result;

CString転送LPCSTR
#include<atlconv.h>//       
USES_CONVERSION;//   T2A      
LPCSTR lPcstrName=(LPCSTR)T2A(cStringName);