为其联系变量CString m_strShow;char tempstr[20];
for(int i = 0; i<20; i++)
    tempstr[i] = m_strShow[i];

解决方案 »

  1.   

    CString本身就可以使用[]操作符。或者用它的SetAt()/GetAt()方法也可以。
      

  2.   

       http://www.csdn.net/expert/Topic/369/369724.shtm
      

  3.   

    用GetBuffer()// example for CString::GetBuffer
    CString s( "abcd" );
    #ifdef _DEBUG
    afxDump << "CString s " << s << "\n";
    #endif
    LPTSTR p = s.GetBuffer( 10 );
    strcpy( p, "Hello" );   // directly access CString buffer
    s.ReleaseBuffer( );
    #ifdef _DEBUG
    afxDump << "CString s " << s << "\n";
    #endif
      

  4.   

    //假设 CString 变量是 text
    char a[20];
    strcpy(a,(LPCSTR)text);//如果 text 的字符串长会超过19个字节,程序中就要多注意
    char a[20];
    if(text.GetLength() <= 19)
       strcpy(a,(LPCSTR)text);
    else
       strncpy(a,(LPCSTR)text,19);