有没有把 int 转化为 CString 的好方法, 比如 124  转化为 CString 类型的 "124"

解决方案 »

  1.   

    方法有几种,下面是比较常用的:
    CString sYourString;
    int iYourInt = 124;
    sYourString.Format("%d", iYourInt);
      

  2.   

    int a = 124;
    CString s;
    s.format("%d", a);//s = "124"
      

  3.   

    CString str;
    int n = 124;
    str.Format("%d", n);
    MessageBox(str); //str="124";
      

  4.   


    itoa( buf, num, 10);
      

  5.   

    CString str;
    str.Format();//format的用法同c语言中的printf
      

  6.   

    itoa 不太好
    int count=1024;
    CString out;
    out.format("数字输出:%d", out);最好结果:数字输出:1024
      

  7.   

    itoa 不太好
    int count=1024;
    CString out;
    out.format("数字输出:%d", count);最好结果:数字输出:1024
      

  8.   

    itoa 不太好
    int count=1024;
    CString out;
    out.format("数字输出:%d", count);最好结果:数字输出:1024
      

  9.   

    我用:
    CString sYourString;
    int iYourInt = 124;
    sYourString.Format("%d", iYourInt);