CString csMsgBody = _T("");
if ( 0 != m_csIntermediateSeriesLoid.Compare( _T("")))
{
csMsgBody.Format( _T("Ioid:/%s/%s oid:/%s/%s"), m_csStudyLoid,
m_csIntermediateSeriesLoid, m_csStudyLoid, m_csReconSeriesLoid );
}
const char* szMsgBody;想把csMsgBody的值赋给szMsgBody,怎么做?尝试了很多转换方式,总是不对

解决方案 »

  1.   

    CString csMsgBody = _T("yyy");
    const char* szMsgBody=(LPCTSTR)csMsgBody;
      

  2.   

    我每次都是 string.GetBuffer(string.GetLength());
      

  3.   

    #include <atlbase.h>
    CString strText(_T(".."));
    USES_CONVERSION;
    char* pszText = T2A(strText);
      

  4.   

     CString strtest="wwwwttttttt";
    1.
    charpoint=strtest.GetBuffer(strtest.GetLength());2.
     char a[100]; 
     CString str("aaaaaa"); 
     strncpy(a,(LPCTSTR)str,sizeof(a));
    3.
     CString  str="aaa";  
      char*  ch;  
      ch=(char*)(LPCTSTR)str;
      

  5.   

    CString str;
    const char* p = (LPCTSTR)str;