CString -> char *

{

CString str;

str = "Hello";

//char* ss = LPSTR(LPCTSTR(str)); 이방법은 안좋다고 하네요. http://cafe.naver.com/woosongbitcafe.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=123

 

ss = str.GetBuffer(0);

str.ReleaseBuffer();

}

 

 

char * -> CString

 {

char ss[] = "Hello";

CString str;

str.Format("%s", ss);

}


BSTR -> CString

{

CString cstr;

char* pstr;

USE_CONVERSION;

pstr = OLE2A(bstr);

cstr = CString(pstr);

}


CString -> BSTR

{

BSTR bstr;

cstr = "adfg";

bstr = cstr.AllocSysString();

}


BSTR -> char*

{

BSTR bstr;

char* pstr;

pstr = OLE2A(bstr);

}

char* -> BSTR

{

TCHAR szTitle[512];

_bstr_t bstrText = szTitle;

*bstr = bstrText.copy();

}

Posted by 빨강토끼
,