想将一个longlong类型的数转换成CString类型,要如何做,vc中有相应的函数吗?
另vc中一般的数值型变量如何转成CString?

解决方案 »

  1.   

    我不知道C++里有没有这样函数,如果没有你就试试这个吧。
    CString __Int64ToStr(__int64 value)
    {
    char strItem[10]={'0','1','2','3','4','5','6','7','8','9'};
    CString _retval;
    __int64 _quotient=value;
    short _surplus=0;
    while(_quotient>0)
    {
    _surplus=_quotient%10;
    _quotient=_quotient/10;
    _retval.AppendChar(strItem[_surplus]);
    }
    _retval=_retval.MakeReverse();
    return _retval;
    }至于其它类型的转换,方法都差不多, 你可以试着自己写个类,把各种转换都封装一下,留着以后用。可以的话,送我点分吧。:)