BSTR GetSafeName(LPCTSTR lpcszStr)
{
CString str = lpcszStr;
str = "[" + str + "]";
return str.AllocSysString();
}void MainFunc()
{
LPCTSTR pstrName1,pstrName2 = "abc";

BSTR strSafeName = GetSafeName(pstrName1); CString strLog; strLog.Format(_T("First safe name = %s"),strSafeName); TRACE(strLog); strSafeName = GetSafeName(pstrName2); strLog.Format(_T("Second safe name = %s"),strSafeName);
}