cstring str;
byte a[100];
a[0]='a';
a[1]='b';
a[2]='c';怎样让str得到a[]的值?如上面的str="abc";
上面的a[]十六进制显示:61,62,63,0D,0A

解决方案 »

  1.   

    abc\n\r  //带了个回车换行。
    str = a;
      

  2.   

    用这个试试
    str.Format("%.*s",3,a);=============================
    全新设计的CSDN助手,支持CSDN所有功能,支持监视、收藏、历史
    http://blog.csdn.net/seasol/archive/2006/06/03/771376.aspx
      

  3.   

    void CDtestDlg::OnButton1() 
    {
    // TODO: Add your control notification handler code here
    CString str;
    byte a[100];
    a[0]='a';
    a[1]='b';
    a[2]='c';
    a[3]='\0';
    strcpy(str.GetBuffer(0),(char *)a);

    AfxMessageBox(str);
    }
      

  4.   

    CString str;
    byte a[100];
    a[0]='a';
    a[1]='b';
    a[2]='c';
    a[3]='\0'; str.Format("%s",a); 

    AfxMessageBox(str);
      

  5.   

    CString str;
    byte a[100];
    memset(a,0,100);
    a[0]=0x61;
    a[1]=0x62;
    a[2]=0x63;
    a[3]=0x0D;
    a[4]=0x0A;
    str.Format("%s",a);
    AfxMessageBox(str);
      

  6.   

    CString str;
    byte a[100];
    a[0]='a';
    a[1]='b';
    a[2]='c';
    str.Format("%.*s",3,a);最后结果str="abc";怎么会不行呢?如果不行,说出具体的情况分析分析。