CString str1="helloo!";
char * m_str="";
如何将str1赋给m_str

解决方案 »

  1.   

    CString str1="helloo!";
    char * m_str="";你的m_str是个指针不能存字符串只能指向存字符串的地址
    m_str = str1.GetBuffer(str1.GetLength());
      

  2.   

    CString str1="helloo!";
    char * m_str=(LPSTR)(LPCTSTR)str1;
      

  3.   

    char * m_str="";
    这样用不好CString str1="helloo!";
    char * m_str;
    m_str = str1.GetBuffer(str1.GetLength());
      

  4.   

    CString str1="helloo!";
    char * m_str;
    m_str = (char*)(const char*)str1;
      

  5.   

    CString str1="helloo!";
    char * m_str;m_str = new char[255];
    strcpy(m_str,str1);