CString 的成员函数Format()int a = 2131;
CString str;
str.Format("%d",a);

解决方案 »

  1.   

    int i=2001;
    char str[10];
    _itoa(i,str,10);
    CString szString=str;
      

  2.   

    int i = 2131;
    char *c=new char[20];
    CString str;sprintf(c,'%d',i);
    str=*c;
      

  3.   

    用   _gcvt 下面是 msdn 的例子
    Example/* _GCVT.C: This program converts -3.1415e5
     * to its string representation.
     */#include <stdlib.h>
    #include <stdio.h>void main( void )
    {
       char buffer[50];
       double source = -3.1415e5;
       _gcvt( source, 7, buffer );
       printf( "source: %f  buffer: '%s'\n", source, buffer );
       _gcvt( source, 7, buffer );
       printf( "source: %e  buffer: '%s'\n", source, buffer );
    }
    Outputsource: -314150.000000  buffer: '-314150.'
    source: -3.141500e+005  buffer: '-314150.'
      

  4.   

    int a = -3.1415e5;
    CString str;
    str.Format("%f",a);
      

  5.   

    CString 的成员函数Format()
    int a = 2131;
    CString str;
    str.Format("%d",a);