TCHARToString

std::string CAlarmWin::TCHARToString( TCHAR* tszBuf )
{
	int nLen = WideCharToMultiByte(CP_ACP, 0,tszBuf, -1, NULL, 0, NULL, NULL);
	char* szRtn = new char[nLen*sizeof(char)];
	WideCharToMultiByte(CP_ACP, 0, tszBuf, -1, szRtn, nLen, NULL, NULL);
	std::string strExp(szRtn);
	CString strTemp = strExp.c_str();
	if (NULL != szRtn)
	{
	  delete []szRtn;
	  szRtn = NULL;
	}
	CStringA strExpressionTemp(strTemp.GetBuffer(0));
	strExp = strExpressionTemp.GetBuffer(0);
	strExpressionTemp.ReleaseBuffer();
	return strExp;	
}

  

posted @ 2019-09-02 19:48  Werial  阅读(195)  评论(0编辑  收藏  举报