LPTSTR lpType;
CString m_strFileName;
想把m_strFileName中的右边三个字符赋给lpType.

解决方案 »

  1.   

    lpType必须先申请内存
    比如
    TCHAR lpType[4]={0};
    lstrcpyn(lpType,m_strFileName.Right(3));//没有作合法判断
      

  2.   

    LPTSTR lpType;
    CString m_strFileName;
    CString strTmp;
    strTmp = m_strFileName.Right(3);
    lpType = LPCTSTR(strTmp);注意,strTmp目前是局部变量.
      

  3.   

    LPTSTR lpType;
    CString m_strFileName;
    CString strTmp;
    strTmp = m_strFileName.Right(3);   //从右取3个
    lpType = LPCTSTR(strTmp);  //强制转换