string转换成LPCTSTR

char * CSupressionDlg::stringToLPCTSTR(string sFrom)

{

	_TCHAR* sBuff = new _TCHAR[sFrom.length() + 2]; 

	int iLength = 0;

	iLength = wsprintf (sBuff,sFrom.c_str ());

	sBuff[iLength+1] = '/0';

	return sBuff;

}

 

CString 转LPCTSTR: CString cStr; const char *lpctStr=(LPCTSTR)cStr; LPCTSTR转CString: LPCTSTR lpctStr; CString cStr=lpctStr;

你可能感兴趣的:(c++)