CString型怎么转为char型

解决方案 »

  1.   

    CString dd = "sdfsdf";
    char* d = (LPTSTR)(LPCTSTR)dd;
      

  2.   

    char *buf=0;
    CString str;
    str.Format("hello");
    sprintf(buf,"%s",str);
      

  3.   

    char *sz;
    CString str;
    sz=str.GetBuffer( str.GetLength()+1);
    str.ReleaseBuffer();
      

  4.   

    char * str1;
    CString str2 = _T("afafasfa");
    str1 = new char [str2.GetLength() + 1];
    memset(str1, 0, str2.GeLength()+1);
    strcpy(str1,str2);
      

  5.   

    CString strCommand,strClientID,strPhone,strContent,strGroupstate;
    char sCommand[3],sClientID[11],sPhone[11],sContent[40],sGroupstate[2];....
    strcpy(sCommand,strCommand);
    strcpy(sClientID,strClientID);
    strcpy(sPhone,strPhone);
    strcpy(sContent,strContent);
    strcpy(sGroupstate,strGroupstate);
      

  6.   

    再问一下
    float int double型怎么转换成char型啊
      

  7.   

    char *buf=0;
    int x=100;
    sprintf(buf,"%d",x);
    ...
      

  8.   

    CString a;
    a.Format("%d",10);
    后面的事情上面已经说了