CString 转 char*; wstring 转 string

1. CString  转 char*

int m_ID(0);

CString name;

name.Format(_T("bookUC%d.txt"),m_ID);

std::wstring _name=name;

_bstr_t t = _name.c_str();

char* pchar = (char*)t;

2. wstring  转 string

wstring ws;

_bstr_t t = ws.c_str();

char* pchar = (char*)t;

string result = pchar;

 

你可能感兴趣的:(String)