CString strtmp = "20120426153853"
int aa = atoi(strtmp); //溢出了……请问VC6.0有转换大整数的API吗?

解决方案 »

  1.   

    直接这样转:
    CString strtmp= "20120426153853";
    __int64  a =  _atoi64(strtmp);
      

  2.   


    用了 还是 会溢出???
    然道 是我排序有问题吗? CString tmp;
    CStringArray saTMP;
    saTMP.Add( "20120201999999" );
    saTMP.Add( "20120306999999" );
    saTMP.Add( "20120111999999" );
    saTMP.Add( "20120825999999" );
    saTMP.Add( "20130207999999" );
    saTMP.Add( "20110331999999" ); for(int i=0; i<saTMP.GetSize(); i++)
    {
    tmp += saTMP.GetAt(i) + "\r\n" ;
    } AfxMessageBox("A:" + tmp); QuickSort( saTMP, 0, saTMP.GetSize()-1 ); tmp.Empty();
    for(i=0; i<saTMP.GetSize(); i++)
    {
    tmp += saTMP.GetAt(i) + "\r\n" ;
    } AfxMessageBox("B:" + tmp);void QuickSort( CStringArray &satime, __int64 Left, __int64 Right )
    {
    CString strTmp;
    __int64 i,j,s;

    if( Left < Right )
    {
    s = _atoi64(satime[Left]);
    i = Left;
    j = Right + 1; while (1)
    {
    while( i+1 < satime.GetSize() && _atoi64(satime[++i]) < s ); while( j-1 > -1 && _atoi64(satime[--j]) > s ); if( i >= j )
    break; strTmp = satime[i];
    satime[i] = satime[j];
    satime[j] = strTmp;
    } satime[Left] = satime[j];
    strTmp.Format("%d", s);
    satime[j] = strTmp;

    QuickSort( satime, Left, j-1 );
    QuickSort( satime, j+1, Right );
    }
    }
      

  3.   

    int、long、unsigned long等之类存不了这么大的基础数据.
      

  4.   

    strTmp.Format("%d", s); 是这个%d的问题吗???
      

  5.   

    LZ 要用__int64 aa这个定义啊
      

  6.   


    我那个排序里有这一句:
    strTmp.Format("%d", s); 
    是这个%d的问题吗???
      

  7.   

    用strTmp.Format"%I64d", s); 试下